るりまサーチ

最速Rubyリファレンスマニュアル検索!
22件ヒット [1-22件を表示] (0.278秒)
トップページ > クエリ:each_with_index[x] > クエリ:with_index[x] > クラス:Enumerator[x]

別のキーワード

  1. _builtin new
  2. _builtin inspect
  3. _builtin []
  4. _builtin to_s
  5. _builtin each

ライブラリ

検索結果

Enumerator#with_index(offset = 0) -> Enumerator (18133.0)

生成時のパラメータに従って、要素にインデックスを添えて繰り返します。 インデックスは offset から始まります。

...//emlist[例][ruby]{
str = "xyz"

enum = Enumerator.new {|y| str.each_byte {|b| y << b }}
enum.with_index {|byte, idx| p [byte, idx] }
# => [120, 0]
# [121, 1]
# [122, 2]

require "stringio"
StringIO.new("foo|bar|baz").each("|").with_index(1) {|s, i| p [s, i] }
# => ["foo|",...
...にインデックスを添えてブロックを繰り返します。
インデックスは 0 から始まります。
Enumerator
#with_index は offset 引数を受け取りますが、
each_with_index
は受け取りません (引数はイテレータメソッドにそのまま渡されます)。...

Enumerator#with_index(offset = 0) {|(*args), idx| ... } -> object (18133.0)

生成時のパラメータに従って、要素にインデックスを添えて繰り返します。 インデックスは offset から始まります。

...//emlist[例][ruby]{
str = "xyz"

enum = Enumerator.new {|y| str.each_byte {|b| y << b }}
enum.with_index {|byte, idx| p [byte, idx] }
# => [120, 0]
# [121, 1]
# [122, 2]

require "stringio"
StringIO.new("foo|bar|baz").each("|").with_index(1) {|s, i| p [s, i] }
# => ["foo|",...
...にインデックスを添えてブロックを繰り返します。
インデックスは 0 から始まります。
Enumerator
#with_index は offset 引数を受け取りますが、
each_with_index
は受け取りません (引数はイテレータメソッドにそのまま渡されます)。...