3件ヒット
[1-3件を表示]
(0.019秒)
ライブラリ
- ビルトイン (3)
キーワード
- next (1)
-
with
_ object (2)
検索結果
先頭3件
-
Enumerator
# next -> object (24022.0) -
「次」のオブジェクトを返します。
...用を
伴っている場合には影響があり得ます。
@raise StopIteration 列挙状態が既に最後へ到達しているとき
@see Enumerator#rewind
//emlist[例1][ruby]{
str = "xyz"
enum = str.each_byte
str.bytesize.times do
puts enum.next
end
# => 120
# 121
# 122... -
Enumerator
# with _ object(obj) -> Enumerator (24022.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_obje... -
Enumerator
# with _ object(obj) {|(*args) , memo _ obj| . . . } -> object (24022.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_obje...