種類
- インスタンスメソッド (1662)
- 特異メソッド (211)
- モジュール関数 (44)
- クラス (33)
- モジュール (11)
クラス
-
ARGF
. class (238) - Array (154)
- Dir (106)
- Enumerator (167)
-
Enumerator
:: ArithmeticSequence (12) -
Enumerator
:: Chain (12) -
Enumerator
:: Lazy (167) -
Enumerator
:: Yielder (27) - Hash (144)
- IO (304)
- Object (44)
- Range (22)
- StopIteration (11)
- String (102)
- Struct (44)
モジュール
- Enumerable (231)
- ObjectSpace (44)
オブジェクト
- ENV (88)
キーワード
- + (6)
- << (11)
- Enumerable (11)
- Enumerator (11)
- Fiber (11)
- Lazy (11)
- bytes (28)
- chars (28)
- chunk (33)
-
chunk
_ while (11) - codepoints (28)
- collect! (22)
-
collect
_ concat (11) -
delete
_ if (22) -
each
_ byte (66) -
each
_ char (66) -
each
_ child (40) -
each
_ codepoint (66) -
each
_ cons (22) -
each
_ entry (22) -
each
_ grapheme _ cluster (14) -
each
_ index (22) -
each
_ key (44) -
each
_ line (132) -
each
_ object (44) -
each
_ pair (66) -
each
_ slice (22) -
each
_ value (44) -
each
_ with _ index (22) -
each
_ with _ object (22) - eager (5)
-
enum
_ for (44) - feed (11)
- filter! (12)
-
flat
_ map (11) - foreach (66)
-
keep
_ if (22) - lines (84)
- map! (22)
- new (29)
- next (11)
-
next
_ values (11) -
peek
_ values (11) - reject! (22)
- result (11)
-
reverse
_ each (44) - rewind (11)
- select! (22)
-
slice
_ after (42) -
slice
_ before (55) -
slice
_ when (21) -
take
_ while (22) -
to
_ enum (44) -
to
_ proc (5) -
with
_ index (22) -
with
_ object (22) - yield (11)
検索結果
先頭5件
-
Enumerator
# each(*args) -> Enumerator (27273.0) -
生成時のパラメータに従ってブロックを繰り返します。 *args を渡した場合は、生成時のパラメータ内引数末尾へ *args を追加した状態で繰り返します。 ブロック付きで呼び出された場合は、 生成時に指定したイテレータの戻り値をそのまま返します。
...返します。
@param args 末尾へ追加する引数
//emlist[例1][ruby]{
str = "Yet Another Ruby Hacker"
enum = Enumerator.new {|y| str.scan(/\w+/) {|w| y << w }}
enum.each {|word| p word } # => "Yet"
# "Another"......scan).each(/\w+/).to_a # => ["Hello", "world"]
obj = Object.new
def obj.each_arg(a, b=:b, *rest)
yield a
yield b
yield rest
:method_returned
end
enum = obj.to_enum :each_arg, :a, :x
enum.each.to_a # => [:a, :x, []]
enum.each.equal?(enum) # => true
enum.each { |e......lm| elm } # => :method_returned
enum.each(:y, :z).to_a # => [:a, :x, [:y, :z]]
enum.each(:y, :z).equal?(enum) # => false
enum.each(:y, :z) { |elm| elm } # => :method_returned
//}... -
Enumerator
# each -> self (27173.0) -
生成時のパラメータに従ってブロックを繰り返します。 *args を渡した場合は、生成時のパラメータ内引数末尾へ *args を追加した状態で繰り返します。 ブロック付きで呼び出された場合は、 生成時に指定したイテレータの戻り値をそのまま返します。
...返します。
@param args 末尾へ追加する引数
//emlist[例1][ruby]{
str = "Yet Another Ruby Hacker"
enum = Enumerator.new {|y| str.scan(/\w+/) {|w| y << w }}
enum.each {|word| p word } # => "Yet"
# "Another"......scan).each(/\w+/).to_a # => ["Hello", "world"]
obj = Object.new
def obj.each_arg(a, b=:b, *rest)
yield a
yield b
yield rest
:method_returned
end
enum = obj.to_enum :each_arg, :a, :x
enum.each.to_a # => [:a, :x, []]
enum.each.equal?(enum) # => true
enum.each { |e......lm| elm } # => :method_returned
enum.each(:y, :z).to_a # => [:a, :x, [:y, :z]]
enum.each(:y, :z).equal?(enum) # => false
enum.each(:y, :z) { |elm| elm } # => :method_returned
//}... -
Enumerator
# each { . . . } -> object (27173.0) -
生成時のパラメータに従ってブロックを繰り返します。 *args を渡した場合は、生成時のパラメータ内引数末尾へ *args を追加した状態で繰り返します。 ブロック付きで呼び出された場合は、 生成時に指定したイテレータの戻り値をそのまま返します。
...返します。
@param args 末尾へ追加する引数
//emlist[例1][ruby]{
str = "Yet Another Ruby Hacker"
enum = Enumerator.new {|y| str.scan(/\w+/) {|w| y << w }}
enum.each {|word| p word } # => "Yet"
# "Another"......scan).each(/\w+/).to_a # => ["Hello", "world"]
obj = Object.new
def obj.each_arg(a, b=:b, *rest)
yield a
yield b
yield rest
:method_returned
end
enum = obj.to_enum :each_arg, :a, :x
enum.each.to_a # => [:a, :x, []]
enum.each.equal?(enum) # => true
enum.each { |e......lm| elm } # => :method_returned
enum.each(:y, :z).to_a # => [:a, :x, [:y, :z]]
enum.each(:y, :z).equal?(enum) # => false
enum.each(:y, :z) { |elm| elm } # => :method_returned
//}... -
Enumerator
# each(*args) { . . . } -> object (27173.0) -
生成時のパラメータに従ってブロックを繰り返します。 *args を渡した場合は、生成時のパラメータ内引数末尾へ *args を追加した状態で繰り返します。 ブロック付きで呼び出された場合は、 生成時に指定したイテレータの戻り値をそのまま返します。
...返します。
@param args 末尾へ追加する引数
//emlist[例1][ruby]{
str = "Yet Another Ruby Hacker"
enum = Enumerator.new {|y| str.scan(/\w+/) {|w| y << w }}
enum.each {|word| p word } # => "Yet"
# "Another"......scan).each(/\w+/).to_a # => ["Hello", "world"]
obj = Object.new
def obj.each_arg(a, b=:b, *rest)
yield a
yield b
yield rest
:method_returned
end
enum = obj.to_enum :each_arg, :a, :x
enum.each.to_a # => [:a, :x, []]
enum.each.equal?(enum) # => true
enum.each { |e......lm| elm } # => :method_returned
enum.each(:y, :z).to_a # => [:a, :x, [:y, :z]]
enum.each(:y, :z).equal?(enum) # => false
enum.each(:y, :z) { |elm| elm } # => :method_returned
//}... -
Enumerator
:: Chain # each(*args) -> Enumerator (21227.0) -
まず最初の繰り返し可能なオブジェクトの each メソッドを args 引数とともに呼び出した後、続く繰り返し可能なオブジェクト も同様に呼び出します。
...まず最初の繰り返し可能なオブジェクトの each メソッドを
args 引数とともに呼び出した後、続く繰り返し可能なオブジェクト
も同様に呼び出します。
ブロックが渡されない場合は Enumerator を返します。... -
Enumerator
:: Chain # each(*args) { |*args| . . . } -> object (21127.0) -
まず最初の繰り返し可能なオブジェクトの each メソッドを args 引数とともに呼び出した後、続く繰り返し可能なオブジェクト も同様に呼び出します。
...まず最初の繰り返し可能なオブジェクトの each メソッドを
args 引数とともに呼び出した後、続く繰り返し可能なオブジェクト
も同様に呼び出します。
ブロックが渡されない場合は Enumerator を返します。... -
Enumerator
:: ArithmeticSequence # each -> self (21104.0) -
各要素に対してブロックを評価します。
各要素に対してブロックを評価します。
@return self を返します。 -
Enumerator
:: ArithmeticSequence # each {|n| . . . } -> self (21104.0) -
各要素に対してブロックを評価します。
各要素に対してブロックを評価します。
@return self を返します。 -
Hash
# each -> Enumerator (18268.0) -
ハッシュのキーと値を引数としてブロックを評価します。
...場合 Enumerator を返します。
each_pair は each のエイリアスです。
//emlist[例][ruby]{
{:a=>1, :b=>2}.each {|a| p a}
#=> [:a, 1]
# [:b, 2]
{:a=>1, :b=>2}.each {|k, v| p [k, v]}
#=> [:a, 1]
# [:b, 2]
p({:a=>1, :b=>2}.each_pair) # => #<Enumerator: {:a=>1, :b=>2}:each_pair>
/....../}
@see Hash#each_key,Hash#each_value... -
IO
# each(limit , chomp: false) -> Enumerator (18244.0) -
IO の現在位置から 1 行ずつ文字列として読み込み、それを引数として 与えられたブロックを実行します。
...を引数として
与えられたブロックを実行します。
ブロックが与えられなかった場合は、自身から生成した
Enumerator オブジェクトを返します。
テキスト読み込みメソッドとして動作します。
limit で最大読み込みバイト数......: 引数なし][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..."
//}
//e......ト数に 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: ne three,... -
IO
# each(rs = $ / , chomp: false) -> Enumerator (18244.0) -
IO の現在位置から 1 行ずつ文字列として読み込み、それを引数として 与えられたブロックを実行します。
...を引数として
与えられたブロックを実行します。
ブロックが与えられなかった場合は、自身から生成した
Enumerator オブジェクトを返します。
テキスト読み込みメソッドとして動作します。
limit で最大読み込みバイト数......: 引数なし][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..."
//}
//e......ト数に 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: ne three,... -
IO
# each(rs , limit , chomp: false) -> Enumerator (18244.0) -
IO の現在位置から 1 行ずつ文字列として読み込み、それを引数として 与えられたブロックを実行します。
...を引数として
与えられたブロックを実行します。
ブロックが与えられなかった場合は、自身から生成した
Enumerator オブジェクトを返します。
テキスト読み込みメソッドとして動作します。
limit で最大読み込みバイト数......: 引数なし][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..."
//}
//e......ト数に 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: ne three,...