るりまサーチ

最速Rubyリファレンスマニュアル検索!
24件ヒット [1-24件を表示] (0.073秒)

別のキーワード

  1. matrix each_with_index
  2. _builtin with_index
  3. mkmf with_config
  4. mkmf with_werror
  5. prime with_object

ライブラリ

クラス

検索結果

Enumerator#with_object(obj) -> Enumerator (18121.0)

繰り返しの各要素に obj を添えてブロックを繰り返し、obj を返り値として返します。

...す。

//emlist[例][ruby]{
# 0,1,2 と呼びだす enumeratorを作る
to_three = Enumerator.new do |y|
3.times do |x|
y << x
end
end

to_three_with_string = to_three.with_object("foo")
to_three_with_string.each do |x,string|
puts "#{string}: #{x}"
end
# => foo:0
# => foo:1
# => foo:2
//...

Enumerator#with_object(obj) {|(*args), memo_obj| ... } -> object (18121.0)

繰り返しの各要素に obj を添えてブロックを繰り返し、obj を返り値として返します。

...す。

//emlist[例][ruby]{
# 0,1,2 と呼びだす enumeratorを作る
to_three = Enumerator.new do |y|
3.times do |x|
y << x
end
end

to_three_with_string = to_three.with_object("foo")
to_three_with_string.each do |x,string|
puts "#{string}: #{x}"
end
# => foo:0
# => foo:1
# => foo:2
//...