28件ヒット
[1-28件を表示]
(0.023秒)
ライブラリ
- ビルトイン (28)
キーワード
- + (6)
-
with
_ object (22)
検索結果
先頭3件
-
Enumerator
# with _ object(obj) -> Enumerator (19.0) -
繰り返しの各要素に obj を添えてブロックを繰り返し、obj を返り値として返します。
...、
最後に obj を返す 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 "#{str......ing}: #{x}"
end
# => foo:0
# => foo:1
# => foo:2
//}
@param obj 繰り返しの各要素に添えて渡されるオブジェクト
@see Enumerable#each_with_object... -
Enumerator
# with _ object(obj) {|(*args) , memo _ obj| . . . } -> object (19.0) -
繰り返しの各要素に obj を添えてブロックを繰り返し、obj を返り値として返します。
...、
最後に obj を返す 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 "#{str......ing}: #{x}"
end
# => foo:0
# => foo:1
# => foo:2
//}
@param obj 繰り返しの各要素に添えて渡されるオブジェクト
@see Enumerable#each_with_object... -
Enumerator
# +(enum) -> Enumerator :: Chain (13.0) -
自身と enum 引数を続けて繰り返す Enumerator::Chain を返します。
...自身と enum 引数を続けて繰り返す Enumerator::Chain を返します。
//emlist[例][ruby]{
e = (1..3).each + [4, 5]
e.to_a #=> [1, 2, 3, 4, 5]
//}
@see Enumerable#chain...