るりまサーチ

最速Rubyリファレンスマニュアル検索!
24件ヒット [1-24件を表示] (0.030秒)
トップページ > クエリ:ruby[x] > クエリ:StringIO[x] > モジュール:Enumerable[x]

別のキーワード

  1. rbconfig ruby
  2. fiddle ruby_free
  3. fiddle build_ruby_platform
  4. rake ruby
  5. rubygems/defaults ruby_engine

ライブラリ

検索結果

Enumerable#each_with_index(*args) -> Enumerator (25.0)

要素とそのインデックスをブロックに渡して繰り返します。

...(each など) にそのまま渡されます。

//emlist[例][ruby]{
[5, 10, 15].each_with_index do |n, idx|
p [n, idx]
end
# => [5, 0]
# [10, 1]
# [15, 2]
//}

//emlist[引数ありの例][ruby]{
require 'stringio'
StringIO
.new("foo|bar|baz").each_with_index("|") do |s, i|
p [s, i]
end...

Enumerable#each_with_index(*args) {|item, index| ... } -> self (25.0)

要素とそのインデックスをブロックに渡して繰り返します。

...(each など) にそのまま渡されます。

//emlist[例][ruby]{
[5, 10, 15].each_with_index do |n, idx|
p [n, idx]
end
# => [5, 0]
# [10, 1]
# [15, 2]
//}

//emlist[引数ありの例][ruby]{
require 'stringio'
StringIO
.new("foo|bar|baz").each_with_index("|") do |s, i|
p [s, i]
end...