32件ヒット
[1-32件を表示]
(0.020秒)
種類
- インスタンスメソッド (22)
- 文書 (10)
ライブラリ
- ビルトイン (22)
クラス
- Enumerator (11)
- StopIteration (11)
キーワード
-
NEWS for Ruby 2
. 2 . 0 (10) - result (11)
検索結果
-
Enumerator
# next -> object (39149.0) -
「次」のオブジェクトを返します。
...合は、
StopIteration 例外を発生します。このとき列挙状態は変化しません。
つまりもう一度 next を呼ぶと再び例外が発生します。
next メソッドによる外部列挙の状態は他のイテレータメソッドによる
内部列挙には影響を与え......到達しているとき
@see Enumerator#rewind
//emlist[例1][ruby]{
str = "xyz"
enum = str.each_byte
str.bytesize.times do
puts enum.next
end
# => 120
# 121
# 122
//}
//emlist[例2][ruby]{
str = "xyz"
enum = str.each_byte
begin
puts enum.next while true
rescue StopIterati......121
# 122
# iteration reached at end
puts enum.next
#=> 再度 StopIteration 例外が発生
//}
//emlist[例3: Kernel.#loop は StopIteration を捕捉します。][ruby]{
str = "xyz"
enum = str.each_byte
loop do
puts enum.next
end
# => 120
# 121
# 122
//}... -
StopIteration
# result -> object (48.0) -
この例外オブジェクトを発生させる原因となったメソッド等の返り値を返します。
...ect = Object.new
def object.each
yield :yield1
yield :yield2
:each_returned
end
enumerator = object.to_enum
p enumerator.next #=> :yield1
p enumerator.next #=> :yield2
begin
enumerator.next
rescue StopIteration => error
p error.result #=> :each_returned
end... -
NEWS for Ruby 2
. 2 . 0 (18.0) -
NEWS for Ruby 2.2.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。
...Enumerable#max, Enumerable#max_by
は複数の値を返すためのオプションをサポートしました
* Float
* 追加: Float#next_float
* 追加: Float#prev_float
* File
* 追加: File.birthtime
* 追加: File#birthtime
* File::Stat
* 追加: File::Stat#b......* TSort.tsort_each, TSort.each_strongly_connected_component,
TSort.each_strongly_connected_component_from はブロックを省略すると Enumerator を返すようになりました。
* xmlrpc
* LibXMLStreamParser という新しいパーサーを追加しました
=== 標準添付......iv_get : internal function. no replacement.
* struct rb_blocking_region_buffer : internal type. no replacement.
* rb_thread_blocking_region_begin -> rb_thread_call_without_gvl family
* rb_thread_blocking_region_end -> rb_thread_call_without_gvl family
* TRAP_BEG -> rb_thread_call_wit...