種類
- インスタンスメソッド (626)
- 特異メソッド (84)
- モジュール関数 (79)
- クラス (73)
- 変数 (11)
ライブラリ
- ビルトイン (873)
クラス
- Array (49)
- Enumerator (139)
-
Enumerator
:: Lazy (11) -
Enumerator
:: Yielder (27) - IO (154)
- Module (11)
- Object (55)
- Range (11)
- StopIteration (11)
- Struct (44)
- Thread (55)
-
Thread
:: Queue (63) -
Thread
:: SizedQueue (36)
モジュール
- Enumerable (44)
- Kernel (46)
- ObjectSpace (44)
キーワード
-
$ stdin (11) - << (11)
- ConditionVariable (9)
- Enumerator (11)
- Fiber (11)
- Proc (11)
- Queue (9)
- Range (11)
- ThreadGroup (11)
- [] (11)
- clear (9)
- close (9)
- closed? (9)
- deq (18)
-
each
_ char (22) -
each
_ entry (22) -
each
_ line (66) -
each
_ object (44) -
each
_ pair (22) -
each
_ with _ index (22) -
enum
_ for (22) - feed (11)
-
instance
_ method (11) - join (22)
- lambda (17)
- length (9)
-
next
_ values (11) - pack (16)
- pass (11)
-
peek
_ values (11) - pop (18)
- proc (18)
-
respond
_ to? (11) - result (11)
- shift (18)
- size (9)
-
to
_ enum (22) -
to
_ proc (5) - value (11)
-
with
_ index (22) -
with
_ object (22) - yield (11)
検索結果
先頭5件
-
Array
. new(size = 0 , val = nil) -> Array (26114.0) -
長さ size の配列を生成し、各要素を val で初期化して返します。
...@param size 配列の長さを数値で指定します。
@param val 配列の要素の値を指定します。
//emlist[例][ruby]{
ary = Array.new(3, "foo")
p ary #=> ["foo", "foo", "foo"]
ary[0].capitalize!
p ary #=> ["Foo", "Foo", "Foo"] (各要素は... -
ObjectSpace
. # each _ object -> Enumerator (14158.0) -
指定された klass と Object#kind_of? の関係にある全ての オブジェクトに対して繰り返します。引数が省略された時には全てのオブ ジェクトに対して繰り返します。 繰り返した数を返します。
...ist[例: ブロックなし][ruby]{
p ObjectSpace.each_object
# => #<Enumerator: ObjectSpace:each_object(false)>
//}
//emlist[例: 全てのオブジェクトを扱う][ruby]{
ObjectSpace.each_object.take(5).each { |x| p x }
count = ObjectSpace.each_object { |x| x }
puts "Total count: #{count}"
#......corrections"
# => Total count: 9938
//}
//emlist[例: 任意のクラスを扱う][ruby]{
Person = Struct.new(:name)
s1 = Person.new("tanaka")
s2 = Person.new("sato")
count = ObjectSpace.each_object(Person) { |x| p x }
puts "Total count: #{count}"
# => #<struct Person name="sato">
# => #<struct P... -
ObjectSpace
. # each _ object {|object| . . . } -> Integer (14158.0) -
指定された klass と Object#kind_of? の関係にある全ての オブジェクトに対して繰り返します。引数が省略された時には全てのオブ ジェクトに対して繰り返します。 繰り返した数を返します。
...ist[例: ブロックなし][ruby]{
p ObjectSpace.each_object
# => #<Enumerator: ObjectSpace:each_object(false)>
//}
//emlist[例: 全てのオブジェクトを扱う][ruby]{
ObjectSpace.each_object.take(5).each { |x| p x }
count = ObjectSpace.each_object { |x| x }
puts "Total count: #{count}"
#......corrections"
# => Total count: 9938
//}
//emlist[例: 任意のクラスを扱う][ruby]{
Person = Struct.new(:name)
s1 = Person.new("tanaka")
s2 = Person.new("sato")
count = ObjectSpace.each_object(Person) { |x| p x }
puts "Total count: #{count}"
# => #<struct Person name="sato">
# => #<struct P... -
ObjectSpace
. # each _ object(klass) -> Enumerator (14158.0) -
指定された klass と Object#kind_of? の関係にある全ての オブジェクトに対して繰り返します。引数が省略された時には全てのオブ ジェクトに対して繰り返します。 繰り返した数を返します。
...ist[例: ブロックなし][ruby]{
p ObjectSpace.each_object
# => #<Enumerator: ObjectSpace:each_object(false)>
//}
//emlist[例: 全てのオブジェクトを扱う][ruby]{
ObjectSpace.each_object.take(5).each { |x| p x }
count = ObjectSpace.each_object { |x| x }
puts "Total count: #{count}"
#......corrections"
# => Total count: 9938
//}
//emlist[例: 任意のクラスを扱う][ruby]{
Person = Struct.new(:name)
s1 = Person.new("tanaka")
s2 = Person.new("sato")
count = ObjectSpace.each_object(Person) { |x| p x }
puts "Total count: #{count}"
# => #<struct Person name="sato">
# => #<struct P... -
ObjectSpace
. # each _ object(klass) {|object| . . . } -> Integer (14158.0) -
指定された klass と Object#kind_of? の関係にある全ての オブジェクトに対して繰り返します。引数が省略された時には全てのオブ ジェクトに対して繰り返します。 繰り返した数を返します。
...ist[例: ブロックなし][ruby]{
p ObjectSpace.each_object
# => #<Enumerator: ObjectSpace:each_object(false)>
//}
//emlist[例: 全てのオブジェクトを扱う][ruby]{
ObjectSpace.each_object.take(5).each { |x| p x }
count = ObjectSpace.each_object { |x| x }
puts "Total count: #{count}"
#......corrections"
# => Total count: 9938
//}
//emlist[例: 任意のクラスを扱う][ruby]{
Person = Struct.new(:name)
s1 = Person.new("tanaka")
s2 = Person.new("sato")
count = ObjectSpace.each_object(Person) { |x| p x }
puts "Total count: #{count}"
# => #<struct Person name="sato">
# => #<struct P... -
IO
# each _ line(limit , chomp: false) -> Enumerator (14148.0) -
IO の現在位置から 1 行ずつ文字列として読み込み、それを引数として 与えられたブロックを実行します。
.../emlist[例: 引数なし][ruby]{
IO.write("testfile", "This is line one,\nThis is line two,\nThis is line three,\nAnd so on...")
f = File.new("testfile")
f.each { |line| p "#{f.lineno}: #{line}" }
# => "1: This is line one,\n"
# "2: This is line two,\n"
# "3: This is line three,\n"
# "4: And so on.......りバイト数に 10 を指定][ruby]{
IO.write("testfile", "This is line one,This is line two,This is line three,And so on...")
f = File.new("testfile")
f.each(",", 10) { |line| p "#{f.lineno}: #{line}" }
# => "0: This is li"
# "1: ne one,"
# "1: This is li"
# "2: ne two,"
# "2: This is li"
# "3:......}
//emlist[例: chomp = true][ruby]{
IO.write("testfile", "This is line one\nThis is line two\nThis is line three\nAnd so on...")
f = File.new("testfile")
f.each(chomp: true) { |line| p "#{f.lineno}: #{line}" }
# => "1: This is line one"
# "2: This is line two"
# "3: This is line three"
# "4: And so... -
IO
# each _ line(limit , chomp: false) {|line| . . . } -> self (14148.0) -
IO の現在位置から 1 行ずつ文字列として読み込み、それを引数として 与えられたブロックを実行します。
.../emlist[例: 引数なし][ruby]{
IO.write("testfile", "This is line one,\nThis is line two,\nThis is line three,\nAnd so on...")
f = File.new("testfile")
f.each { |line| p "#{f.lineno}: #{line}" }
# => "1: This is line one,\n"
# "2: This is line two,\n"
# "3: This is line three,\n"
# "4: And so on.......りバイト数に 10 を指定][ruby]{
IO.write("testfile", "This is line one,This is line two,This is line three,And so on...")
f = File.new("testfile")
f.each(",", 10) { |line| p "#{f.lineno}: #{line}" }
# => "0: This is li"
# "1: ne one,"
# "1: This is li"
# "2: ne two,"
# "2: This is li"
# "3:......}
//emlist[例: chomp = true][ruby]{
IO.write("testfile", "This is line one\nThis is line two\nThis is line three\nAnd so on...")
f = File.new("testfile")
f.each(chomp: true) { |line| p "#{f.lineno}: #{line}" }
# => "1: This is line one"
# "2: This is line two"
# "3: This is line three"
# "4: And so... -
IO
# each _ line(rs = $ / , chomp: false) -> Enumerator (14148.0) -
IO の現在位置から 1 行ずつ文字列として読み込み、それを引数として 与えられたブロックを実行します。
.../emlist[例: 引数なし][ruby]{
IO.write("testfile", "This is line one,\nThis is line two,\nThis is line three,\nAnd so on...")
f = File.new("testfile")
f.each { |line| p "#{f.lineno}: #{line}" }
# => "1: This is line one,\n"
# "2: This is line two,\n"
# "3: This is line three,\n"
# "4: And so on.......りバイト数に 10 を指定][ruby]{
IO.write("testfile", "This is line one,This is line two,This is line three,And so on...")
f = File.new("testfile")
f.each(",", 10) { |line| p "#{f.lineno}: #{line}" }
# => "0: This is li"
# "1: ne one,"
# "1: This is li"
# "2: ne two,"
# "2: This is li"
# "3:......}
//emlist[例: chomp = true][ruby]{
IO.write("testfile", "This is line one\nThis is line two\nThis is line three\nAnd so on...")
f = File.new("testfile")
f.each(chomp: true) { |line| p "#{f.lineno}: #{line}" }
# => "1: This is line one"
# "2: This is line two"
# "3: This is line three"
# "4: And so... -
IO
# each _ line(rs = $ / , chomp: false) {|line| . . . } -> self (14148.0) -
IO の現在位置から 1 行ずつ文字列として読み込み、それを引数として 与えられたブロックを実行します。
.../emlist[例: 引数なし][ruby]{
IO.write("testfile", "This is line one,\nThis is line two,\nThis is line three,\nAnd so on...")
f = File.new("testfile")
f.each { |line| p "#{f.lineno}: #{line}" }
# => "1: This is line one,\n"
# "2: This is line two,\n"
# "3: This is line three,\n"
# "4: And so on.......りバイト数に 10 を指定][ruby]{
IO.write("testfile", "This is line one,This is line two,This is line three,And so on...")
f = File.new("testfile")
f.each(",", 10) { |line| p "#{f.lineno}: #{line}" }
# => "0: This is li"
# "1: ne one,"
# "1: This is li"
# "2: ne two,"
# "2: This is li"
# "3:......}
//emlist[例: chomp = true][ruby]{
IO.write("testfile", "This is line one\nThis is line two\nThis is line three\nAnd so on...")
f = File.new("testfile")
f.each(chomp: true) { |line| p "#{f.lineno}: #{line}" }
# => "1: This is line one"
# "2: This is line two"
# "3: This is line three"
# "4: And so... -
IO
# each _ line(rs , limit , chomp: false) -> Enumerator (14148.0) -
IO の現在位置から 1 行ずつ文字列として読み込み、それを引数として 与えられたブロックを実行します。
.../emlist[例: 引数なし][ruby]{
IO.write("testfile", "This is line one,\nThis is line two,\nThis is line three,\nAnd so on...")
f = File.new("testfile")
f.each { |line| p "#{f.lineno}: #{line}" }
# => "1: This is line one,\n"
# "2: This is line two,\n"
# "3: This is line three,\n"
# "4: And so on.......りバイト数に 10 を指定][ruby]{
IO.write("testfile", "This is line one,This is line two,This is line three,And so on...")
f = File.new("testfile")
f.each(",", 10) { |line| p "#{f.lineno}: #{line}" }
# => "0: This is li"
# "1: ne one,"
# "1: This is li"
# "2: ne two,"
# "2: This is li"
# "3:......}
//emlist[例: chomp = true][ruby]{
IO.write("testfile", "This is line one\nThis is line two\nThis is line three\nAnd so on...")
f = File.new("testfile")
f.each(chomp: true) { |line| p "#{f.lineno}: #{line}" }
# => "1: This is line one"
# "2: This is line two"
# "3: This is line three"
# "4: And so... -
IO
# each _ line(rs , limit , chomp: false) {|line| . . . } -> self (14148.0) -
IO の現在位置から 1 行ずつ文字列として読み込み、それを引数として 与えられたブロックを実行します。
.../emlist[例: 引数なし][ruby]{
IO.write("testfile", "This is line one,\nThis is line two,\nThis is line three,\nAnd so on...")
f = File.new("testfile")
f.each { |line| p "#{f.lineno}: #{line}" }
# => "1: This is line one,\n"
# "2: This is line two,\n"
# "3: This is line three,\n"
# "4: And so on.......りバイト数に 10 を指定][ruby]{
IO.write("testfile", "This is line one,This is line two,This is line three,And so on...")
f = File.new("testfile")
f.each(",", 10) { |line| p "#{f.lineno}: #{line}" }
# => "0: This is li"
# "1: ne one,"
# "1: This is li"
# "2: ne two,"
# "2: This is li"
# "3:......}
//emlist[例: chomp = true][ruby]{
IO.write("testfile", "This is line one\nThis is line two\nThis is line three\nAnd so on...")
f = File.new("testfile")
f.each(chomp: true) { |line| p "#{f.lineno}: #{line}" }
# => "1: This is line one"
# "2: This is line two"
# "3: This is line three"
# "4: And so... -
IO
# each _ line(limit) -> Enumerator (14136.0) -
IO の現在位置から 1 行ずつ文字列として読み込み、それを引数として 与えられたブロックを実行します。
.../emlist[例: 引数なし][ruby]{
IO.write("testfile", "This is line one,\nThis is line two,\nThis is line three,\nAnd so on...")
f = File.new("testfile")
f.each { |line| p "#{f.lineno}: #{line}" }
# => "1: This is line one,\n"
# "2: This is line two,\n"
# "3: This is line three,\n"
# "4: And so on.......りバイト数に 10 を指定][ruby]{
IO.write("testfile", "This is line one,This is line two,This is line three,And so on...")
f = File.new("testfile")
f.each(",", 10) { |line| p "#{f.lineno}: #{line}" }
# => "0: This is li"
# "1: ne one,"
# "1: This is li"
# "2: ne two,"
# "2: This is li"
# "3:...