るりまサーチ

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

別のキーワード

  1. string []=
  2. string slice!
  3. string slice
  4. string []
  5. openssl utf8string

ライブラリ

クラス

キーワード

検索結果

<< < 1 2 >>

Enumerator#with_object(obj) -> Enumerator (67.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...

Enumerator#with_object(obj) {|(*args), memo_obj| ... } -> object (67.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...
<< < 1 2 >>