File tree 16 files changed +79
-79
lines changed
bg/documentation/ruby-from-other-languages
de/documentation/ruby-from-other-languages
en/documentation/ruby-from-other-languages
es/documentation/ruby-from-other-languages
fr/documentation/ruby-from-other-languages
id/documentation/ruby-from-other-languages
it/documentation/ruby-from-other-languages
ja/documentation/ruby-from-other-languages
ko/documentation/ruby-from-other-languages
pl/documentation/ruby-from-other-languages
pt/documentation/ruby-from-other-languages
ru/documentation/ruby-from-other-languages
tr/documentation/ruby-from-other-languages
vi/documentation/ruby-from-other-languages
zh_cn/documentation/ruby-from-other-languages
zh_tw/documentation/ruby-from-other-languages
16 files changed +79
-79
lines changed Original file line number Diff line number Diff line change @@ -259,12 +259,12 @@ t1 == t2
259
259
### Отворени класове
260
260
261
261
Класовете в Ruby могат винаги да бъдат отворени, за да се допълват и променят.
262
- Всеки вграден клас от стандартната библиотека, като ` Fixnum ` или дори ` Object ` ,
262
+ Всеки вграден клас от стандартната библиотека, като ` Integer ` или дори ` Object ` ,
263
263
родителят на всички обекти, може да бъде променен. Ruby on Rails дефинира
264
- множество методи за употребата на дати и времена във ` Fixnum ` . Пример:
264
+ множество методи за употребата на дати и времена във ` Integer ` . Пример:
265
265
266
266
{% highlight ruby %}
267
- class Fixnum
267
+ class Integer
268
268
def hours
269
269
self * 3600 # number of seconds in an hour
270
270
end
@@ -373,10 +373,10 @@ method(:puts).call "puts is an object!"
373
373
### Операторите са синтактична захар
374
374
375
375
Повечето оператори са "синтактична захар" за извиквания на методи. Може
376
- например да се предифинира ` Fixnum #+` :
376
+ например да се предифинира ` Integer #+` :
377
377
378
378
{% highlight ruby %}
379
- class Fixnum
379
+ class Integer
380
380
# You can, but please don't do this
381
381
def +(other)
382
382
self - other
Original file line number Diff line number Diff line change @@ -292,12 +292,12 @@ t1 == t2
292
292
### Offene Klassen
293
293
294
294
Ruby-Klassen sind offen. Du kannst sie jeder Zeit verändern und ihnen
295
- Methoden hinzufügen. Sogar eingebaute Klassen wie ` Fixnum ` oder ` Object `
296
- (die Mutter aller Objekte) sind erweiterbar. ActiveSupport fügt ` Fixnum `
295
+ Methoden hinzufügen. Sogar eingebaute Klassen wie ` Integer ` oder ` Object `
296
+ (die Mutter aller Objekte) sind erweiterbar. ActiveSupport fügt ` Integer `
297
297
viele Methoden zur Erzeugung von Zeitangaben hinzu:
298
298
299
299
{% highlight ruby %}
300
- class Fixnum
300
+ class Integer
301
301
def hours
302
302
self * 3600 # Anzahl der Sekunden in einer Stunde
303
303
end
@@ -418,10 +418,10 @@ method(:puts).call "puts ist ein Objekt!"
418
418
419
419
Die meisten Operatoren in Ruby sind nur Methodenaufrufe mit einer
420
420
speziellen Syntax (und ein paar Vorrangregeln). Du kannst zum Beispiel
421
- die Methode ` + ` für ` Fixnum ` überschreiben:
421
+ die Methode ` + ` für ` Integer ` überschreiben:
422
422
423
423
{% highlight ruby %}
424
- class Fixnum
424
+ class Integer
425
425
# Du kannst, aber bitte tu es nicht.
426
426
def +(other)
427
427
self - other
Original file line number Diff line number Diff line change @@ -270,12 +270,12 @@ t1 == t2
270
270
### Classes are open
271
271
272
272
Ruby classes are open. You can open them up, add to them, and change them at
273
- any time. Even core classes, like ` Fixnum ` or even ` Object ` , the parent of all
273
+ any time. Even core classes, like ` Integer ` or even ` Object ` , the parent of all
274
274
objects. Ruby on Rails defines a bunch of methods for dealing with time on
275
- ` Fixnum ` . Watch:
275
+ ` Integer ` . Watch:
276
276
277
277
{% highlight ruby %}
278
- class Fixnum
278
+ class Integer
279
279
def hours
280
280
self * 3600 # number of seconds in an hour
281
281
end
@@ -390,11 +390,11 @@ method(:puts).call "puts is an object!"
390
390
### Operators are syntactic sugar
391
391
392
392
Most operators in Ruby are just syntactic sugar (with some precedence
393
- rules) for method calls. You can, for example, override Fixnum ’s ` + `
393
+ rules) for method calls. You can, for example, override Integer ’s ` + `
394
394
method:
395
395
396
396
{% highlight ruby %}
397
- class Fixnum
397
+ class Integer
398
398
# You can, but please don't do this
399
399
def +(other)
400
400
self - other
Original file line number Diff line number Diff line change @@ -286,12 +286,12 @@ t1 == t2
286
286
287
287
Las clases de Ruby están abiertas. Puedes abrirlas, agregarles
288
288
funcionalidad y modificarlas en cualquier momento. Incluso las clases
289
- principales, como ` Fixnum ` o incluso ` Object ` , el padre de todos los
289
+ principales, como ` Integer ` o incluso ` Object ` , el padre de todos los
290
290
objetos. Ruby on Rails define un montón de métodos para manejar el
291
- tiempo y los horarios en ` Fixnum ` . Mira:
291
+ tiempo y los horarios en ` Integer ` . Mira:
292
292
293
293
{% highlight ruby %}
294
- class Fixnum
294
+ class Integer
295
295
def hours
296
296
self * 3600 # cantidad de segundos en una hora
297
297
end
@@ -410,10 +410,10 @@ method(:puts).call "¡puts es un objeto!"
410
410
411
411
La mayoría de los operadores en Ruby son simples simplificaciones
412
412
sintácticas (con algunas reglas de precedencia) para llamar a ciertos
413
- métodos. Puedes, por ejemplo, redefinir el método ` Fixnum #+` \:
413
+ métodos. Puedes, por ejemplo, redefinir el método ` Integer #+` \:
414
414
415
415
{% highlight ruby %}
416
- class Fixnum
416
+ class Integer
417
417
# Puedes, pero por favor no lo hagas
418
418
def +(otro)
419
419
self - otro
Original file line number Diff line number Diff line change @@ -285,12 +285,12 @@ t1 == t2
285
285
286
286
Ouvertes à la modification, à tout moment. Vous pouvez y faire des
287
287
ajouts, les modifier durant l’exécution. Y compris les classes
288
- standards, telles que ` Fixnum ` , voire ` Object ` , la classe parente de
288
+ standards, telles que ` Integer ` , voire ` Object ` , la classe parente de
289
289
toute autre. Par exemple, l’application Ruby on Rails défini nombre de
290
- méthodes pour traiter le temps, au sein de ` Fixnum ` . Voyez ceci :
290
+ méthodes pour traiter le temps, au sein de ` Integer ` . Voyez ceci :
291
291
292
292
{% highlight ruby %}
293
- class Fixnum
293
+ class Integer
294
294
def hours
295
295
self * 3600 # nombre de secondes dans une heure
296
296
end
@@ -412,10 +412,10 @@ method(:puts).call "puts est un objet !"
412
412
413
413
La plupart des opérateurs ne sont là que pour faciliter la vie du
414
414
programmeur (et gèrent aussi les règles de priorité mathématique). Vous
415
- pouvez, par exemple, redéfinir la méthode ` + ` de la classe ` Fixnum ` \:
415
+ pouvez, par exemple, redéfinir la méthode ` + ` de la classe ` Integer ` \:
416
416
417
417
{% highlight ruby %}
418
- class Fixnum
418
+ class Integer
419
419
# Possible, mais pas recommandé...
420
420
def +(other)
421
421
self - other
Original file line number Diff line number Diff line change @@ -293,13 +293,13 @@ t1 == t2
293
293
294
294
Kelas Ruby bersifat terbuka. Anda bisa membuka ` Class ` , lalu menambahkan
295
295
ke dalam ` Class ` , dan menggantinya kapan saja. Bahkan kelas yang
296
- termasuk class inti, seperti kelas ` Fixnum ` atau bahkan kelas ` Object ` ,
296
+ termasuk class inti, seperti kelas ` Integer ` atau bahkan kelas ` Object ` ,
297
297
induk dari semua obyek di Ruby. Ruby on Rails mendefinisikan banyak
298
- metode yang berhubungan dengan waktu ke dalam kelas ` Fixnum ` . Perhatikan
298
+ metode yang berhubungan dengan waktu ke dalam kelas ` Integer ` . Perhatikan
299
299
kode berikut:
300
300
301
301
{% highlight ruby %}
302
- class Fixnum
302
+ class Integer
303
303
def hours
304
304
self * 3600 # total detik dalam satu jam adalah 3600
305
305
end
@@ -431,10 +431,10 @@ Kebanyakan operator di Ruby hanyalah *syntactic sugar*. Maksudnya
431
431
operator-operator itu, mereka sebenarnya hanyalah pemanggilan metode
432
432
saja, tentunya dengan peraturan tertentu supaya jenjang * precedence*
433
433
tetap dituruti. Contohnya, Anda bisa meng-* override* metode + milik
434
- kelas Fixnum :
434
+ kelas Integer :
435
435
436
436
{% highlight ruby %}
437
- class Fixnum
437
+ class Integer
438
438
# Sebenarnya Anda bisa melakukan ini,
439
439
# tetapi tolong jangan lakukan ini
440
440
def +(other)
Original file line number Diff line number Diff line change @@ -281,12 +281,12 @@ t1 == t2
281
281
282
282
In Ruby, tutte le classi sono “aperte”. Questo vuol dire che puoi aggiungere
283
283
metodi e variabili e cambiarle in qualsiasi momento, e questo vale anche per
284
- classi interne, come ` Fixnum ` o anche ` Object ` , il “genitore” di tutti gli
284
+ classi interne, come ` Integer ` o anche ` Object ` , il “genitore” di tutti gli
285
285
oggetti. Ruby on Rails, per esempio, definisce una serie di metodi per fare
286
- operazioni temporali con oggetti ` Fixnum ` \:
286
+ operazioni temporali con oggetti ` Integer ` \:
287
287
288
288
{% highlight ruby %}
289
- class Fixnum
289
+ class Integer
290
290
def hours
291
291
self * 3600 # numero di secondi in un'ora
292
292
end
@@ -410,10 +410,10 @@ method(:puts).call "puts è un oggetto!"
410
410
411
411
Molti degli operatori sono solamente dello “zucchero sintattico” (con
412
412
alcune regole di precendenza però) per delle chiamate a dei metodi. È
413
- possibile, per esempio, ridefinire il metodo ”+” della classe Fixnum :
413
+ possibile, per esempio, ridefinire il metodo ”+” della classe Integer :
414
414
415
415
{% highlight ruby %}
416
- class Fixnum
416
+ class Integer
417
417
# Puoi farlo, ma è meglio di no!
418
418
def +(other)
419
419
self - other
Original file line number Diff line number Diff line change @@ -283,12 +283,12 @@ t1 == t2
283
283
284
284
Rubyのクラスは開いています。
285
285
いつでもクラスを開いて、定義を足したり、変更することができます。
286
- ` Fixnum ` や、すべてのオブジェクトの祖先である` Object ` のようなクラスであっても、
286
+ ` Integer ` や、すべてのオブジェクトの祖先である` Object ` のようなクラスであっても、
287
287
自由に再定義することが可能です。Ruby on Railsは、次のような
288
- ` Fixnum ` に時間を扱うメソッド群を定義しています。
288
+ ` Integer ` に時間を扱うメソッド群を定義しています。
289
289
290
290
{% highlight ruby %}
291
- class Fixnum
291
+ class Integer
292
292
def hours
293
293
self * 3600 # 1時間あたりの秒数を返します
294
294
end
@@ -406,10 +406,10 @@ method(:puts).call "putsはオブジェクト!"
406
406
407
407
Rubyにおけるほとんどの演算子は糖衣構文です。
408
408
いくつかの優先順位規則にもとづいて、メソッド呼び出しを単に書き換えているだけです。
409
- たとえば、Fixnumクラスの ` + ` メソッドを次のようにオーバーライドすることもできます。
409
+ たとえば、Integerクラスの ` + ` メソッドを次のようにオーバーライドすることもできます。
410
410
411
411
{% highlight ruby %}
412
- class Fixnum
412
+ class Integer
413
413
# できるけれど、しないほうがいいでしょう
414
414
def +(other)
415
415
self - other
Original file line number Diff line number Diff line change @@ -257,12 +257,12 @@ t1 == t2
257
257
### 열린 클래스
258
258
259
259
루비의 클래스는 열려 있습니다. 언제든 클래스를 열어서, 추가하고, 변경할 수
260
- 있습니다. ` Fixnum ` 이나 심지어 모든 객체의 부모인 ` Object ` 같은 코어 클래스도
261
- 예외는 아닙니다. 루비 온 레일즈에서는 시간을 제어하기 위해 ` Fixnum ` 에 많은
260
+ 있습니다. ` Integer ` 나 심지어 모든 객체의 부모인 ` Object ` 같은 코어 클래스도
261
+ 예외는 아닙니다. 루비 온 레일즈에서는 시간을 제어하기 위해 ` Integer ` 에 많은
262
262
메서드를 추가해서 사용합니다. 밑을 보세요.
263
263
264
264
{% highlight ruby %}
265
- class Fixnum
265
+ class Integer
266
266
def hours
267
267
self * 3600 # 한 시간을 초로 환산한 수
268
268
end
@@ -377,11 +377,11 @@ method(:puts).call "puts is an object!"
377
377
### 연산자는 신택스 슈거
378
378
379
379
루비의 대부분의 연산자는 메서드 호출의 (몇가지 우선순위 규칙을
380
- 포함한) 신택스 슈거입니다. 예를 들어, Fixnum의 + 메서드를 오버라이드
380
+ 포함한) 신택스 슈거입니다. 예를 들어, Integer의 + 메서드를 오버라이드
381
381
할 수 있습니다.
382
382
383
383
{% highlight ruby %}
384
- class Fixnum
384
+ class Integer
385
385
# 할 수는 있지만, 하지 마세요.
386
386
def +(other)
387
387
self - other
Original file line number Diff line number Diff line change @@ -266,12 +266,12 @@ t1 == t2
266
266
267
267
Klasy Rubiego są otwarte. Można je otworzyć, dodać nowe metody czy
268
268
zmienić istniejące działanie w dowolnym momencie. Nawet główne klasy
269
- takie jak ` Fixnum ` czy nawet ` Object ` , rodzic wszystkich obiektów. Ruby
269
+ takie jak ` Integer ` czy nawet ` Object ` , rodzic wszystkich obiektów. Ruby
270
270
on Rails na przykład definiuje zestaw metod do operowania czasem w
271
- klasie ` Fixnum ` . Poniżej:
271
+ klasie ` Integer ` . Poniżej:
272
272
273
273
{% highlight ruby %}
274
- class Fixnum
274
+ class Integer
275
275
def hours
276
276
self * 3600 # liczba sekund w godzinie
277
277
end
@@ -390,10 +390,10 @@ method(:puts).call "puts to obiekt!"
390
390
### Operatory to cukier syntaktyczny
391
391
392
392
Większość operatorów w Rubim to po prostu cukier syntaktyczny dla
393
- wywołań metod. Możesz, na przykład, nadpisać metodę + klasy Fixnum :
393
+ wywołań metod. Możesz, na przykład, nadpisać metodę + klasy Integer :
394
394
395
395
{% highlight ruby %}
396
- class Fixnum
396
+ class Integer
397
397
# Możesz, ale proszę nie rób tego !
398
398
def +(other)
399
399
self - other
Original file line number Diff line number Diff line change @@ -275,12 +275,12 @@ t1 == t2
275
275
### As Classes são abertas
276
276
277
277
As classes em Ruby são abertas. Poderá abrir, adicionar e alterá-las a
278
- qualquer altura. Mesmo as classes do núcleo como por exemplo ` Fixnum ` ou
278
+ qualquer altura. Mesmo as classes do núcleo como por exemplo ` Integer ` ou
279
279
mesmo a classe ` Object ` , a classe de topo. O Ruby on Rails define uma
280
- quantidade de métodos para lidar com as horas na classe ` Fixnum ` . Veja:
280
+ quantidade de métodos para lidar com as horas na classe ` Integer ` . Veja:
281
281
282
282
{% highlight ruby %}
283
- class Fixnum
283
+ class Integer
284
284
def horas
285
285
self * 3600 # nu'mero de segundos numa hora
286
286
end
@@ -405,10 +405,10 @@ method(:puts).call "puts e' um objecto!"
405
405
406
406
A maioria dos operadores em Ruby são somente açúcar sintático (com
407
407
algumas regras de precedência) para chamadas a métodos. Poderá, por
408
- exemplo, redifinir o método + da classe Fixnum :
408
+ exemplo, redifinir o método + da classe Integer :
409
409
410
410
{% highlight ruby %}
411
- class Fixnum
411
+ class Integer
412
412
# Pode fazer, mas por favor não faça isto
413
413
def +(outro)
414
414
self - outro
Original file line number Diff line number Diff line change @@ -261,12 +261,12 @@ t1 == t2
261
261
### Открытые классы
262
262
263
263
Классы в Ruby "открыты". То есть, вы можете открыть их и добавить или изменить их
264
- в любое время. Даже базовые классы, такие как ` Fixnum ` или ` Object ` , родительский
265
- для всех объектов. Ruby on Rails определяет несколько методов на ` Fixnum ` , чтобы
264
+ в любое время. Даже базовые классы, такие как ` Integer ` или ` Object ` , родительский
265
+ для всех объектов. Ruby on Rails определяет несколько методов на ` Integer ` , чтобы
266
266
работать со временем. Смотрите:
267
267
268
268
{% highlight ruby %}
269
- class Fixnum
269
+ class Integer
270
270
def hours
271
271
self * 3600 # число секунд в 1 часе
272
272
end
@@ -381,10 +381,10 @@ method(:puts).call "puts is an object!"
381
381
382
382
Большинство операторов в Ruby - это просто синтаксический сахар (с учетом некоторых
383
383
правил) для вызова методов. Например, можно переопределить ` + ` метод для класса
384
- ` Fixnum ` :
384
+ ` Integer ` :
385
385
386
386
{% highlight ruby %}
387
- class Fixnum
387
+ class Integer
388
388
# Так можно, но не значит, что нужно ;)
389
389
def +(other)
390
390
self - other
Original file line number Diff line number Diff line change @@ -254,12 +254,12 @@ t1 == t2
254
254
### Sınıflar Açıktır
255
255
256
256
Ruby sınıfları açıktır. İstediğiniz zaman açabilir, ekleme yapabilir,
257
- değiştirebilirsiniz. Core sınıfları bile, mesela ` Fixnum ` ve hatta tüm
258
- sınıfların anası ` Object ` sınıfı dahil. Ruby on Rails ` Fixnum ` sınıfına
257
+ değiştirebilirsiniz. Core sınıfları bile, mesela ` Integer ` ve hatta tüm
258
+ sınıfların anası ` Object ` sınıfı dahil. Ruby on Rails ` Integer ` sınıfına
259
259
zamanla ilgili bir kısım metod eklemiştir. İzleyin:
260
260
261
261
{% highlight ruby %}
262
- class Fixnum
262
+ class Integer
263
263
def hours
264
264
self * 3600 # bir saat içindeki saniye miktarı
265
265
end
@@ -375,10 +375,10 @@ method(:puts).call "puts is an object!"
375
375
### Operatörler de Deyimdir
376
376
377
377
Ruby’deki operatörler birbirlerine belli öncelikleri olan metodlardır.
378
- Bu yüzden isterseniz Fixnum ’un + metodunu değiştirebilirsiniz:
378
+ Bu yüzden isterseniz Integer ’un + metodunu değiştirebilirsiniz:
379
379
380
380
{% highlight ruby %}
381
- class Fixnum
381
+ class Integer
382
382
# Yapabilirsiniz ama lütfen bunu yapmayın
383
383
def +(other)
384
384
self - other
You can’t perform that action at this time.
0 commit comments