22件ヒット
[1-22件を表示]
(0.056秒)
ライブラリ
- ビルトイン (22)
検索結果
先頭2件
-
Enumerator
# with _ object(obj) -> Enumerator (25.0) -
繰り返しの各要素に obj を添えてブロックを繰り返し、obj を返り値として返します。
...bj を返す Enumerator を返します。
//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... -
Enumerator
# with _ object(obj) {|(*args) , memo _ obj| . . . } -> object (25.0) -
繰り返しの各要素に obj を添えてブロックを繰り返し、obj を返り値として返します。
...bj を返す Enumerator を返します。
//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...