44件ヒット
[1-44件を表示]
(0.047秒)
種類
- 文書 (22)
- 特異メソッド (11)
- インスタンスメソッド (11)
ライブラリ
- ビルトイン (22)
クラス
-
Enumerator
:: Lazy (11) - StopIteration (11)
キーワード
-
NEWS for Ruby 2
. 3 . 0 (9) -
NEWS for Ruby 2
. 6 . 0 (6) -
NEWS for Ruby 3
. 0 . 0 (4) -
NEWS for Ruby 3
. 1 . 0 (3) - new (11)
検索結果
先頭5件
-
StopIteration
# result -> object (18149.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... -
Enumerator
:: Lazy . new(obj , size=nil) {|yielder , *values| . . . } -> Enumerator :: Lazy (3179.0) -
Lazy Enumerator を作成します。Enumerator::Lazy#force メソッドなどに よって列挙が実行されたとき、objのeachメソッドが実行され、値が一つずつ ブロックに渡されます。ブロックは、yielder を使って最終的に yield される値を 指定できます。
...Lazy Enumerator を作成します。Enumerator::Lazy#force メソッドなどに
よって列挙が実行されたとき、objのeachメソッドが実行され、値が一つずつ
ブロックに渡されます。ブロックは、yielder を使って最終的に yield される値を
指定で......dule Enumerable
def filter_map(&block)
map(&block).compact
end
end
class Enumerator::Lazy
def filter_map
Lazy.new(self) do |yielder, *values|
result = yield *values
yielder << result if result
end
end
end
1.step.lazy.filter_map{|i| i*i if i.even?}.first(5)
# =>......[4, 16, 36, 64, 100]
//}
@raise ArgumentError 引数を指定しなかった場合、ブロックを指定しなかった場合に発生します。
@see Enumerator.new... -
NEWS for Ruby 2
. 6 . 0 (120.0) -
NEWS for Ruby 2.6.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。
...ist{
ary[1..] # ary[1..-1] と同じ
(1...).each {|index| block } # index が 1 から始まる無限ループ
ary.zip(1..) {|elem, index| block } # ary.each.with_index(1) { }
//}
* キーワード引数のハッシュに Symbol 以外の......* Dir
* 新規メソッド
* Dir#each_child と Dir#children 追加 13969
* Enumerable
* 新規メソッド
* Enumerable#chain はレシーバと引数のそれぞれの要素を順番にイテレートする
Enumerator::Chain オブジェクトを返します。 1......* :oneshot_lines キーワード引数が Coverage.start に追加されました。
* :stop と :clear キーワード引数が Coverage.result に追加されました。
clear が真の時、カウンターが0クリアされます。
stop が真の時、カバレッジ... -
NEWS for Ruby 3
. 1 . 0 (90.0) -
NEWS for Ruby 3.1.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。
...17411
//emlist{
Prime.each_cons(2).lazy.find_all{_1 in [n, ^(n + 2)]}.take(3).to_a
#=> [[3, 5], [5, 7], [11, 13]]
//}
* ピン演算子がインスタンス変数、クラス変数、グローバル変数をサポートしました。 17724
//emlist{
@n = 5
Prime.each_cons(2).lazy.find{_1 in [......では、
//emlist[][ruby]{
foo[0] = bar
//}
* 次の評価順序になります。
//emlist{
1. `foo`
2. `bar`
3. `[]=` called on the result of `foo`
//}
* Ruby 3.1.0より前は、多重代入の評価順序が上記のようではありませんでした。このコードでは、......e#each_sliceがレシーバを返すようになりました。 https://github.com/ruby/ruby/pull/1509
//emlist[Enumerable#each_cons Enumerable#each_slice][ruby]{
[1, 2, 3].each_cons(2){}
# 3.0 => nil
# 3.1 => [1, 2, 3]
[1, 2, 3].each_slice(2){}
# 3.0 => nil
# 3.1 => [1, 2, 3]
//}
* Enumerator:... -
NEWS for Ruby 3
. 0 . 0 (54.0) -
NEWS for Ruby 3.0.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。
...さい。
== 言語仕様の変更
* Keyword arguments are now separated from positional arguments.
Code that resulted in deprecation warnings in Ruby 2.7 will now
result in ArgumentError or different behavior. 14183
* Procs accepting a single rest argument and keywords are no longer......Array#take_while
* Array#uniq
* Array#*
* Can be sliced with Enumerator::ArithmeticSequence
//emlist[][ruby]{
dirty_data = ['--', 'data1', '--', 'data2', '--', 'data3']
dirty_data[(1..).step(2)] # take each second element
# => ["data1", "data2", "data3"]
//}
* Binding
* Bind......nVariable#wait may now invoke the `block`/`unblock` scheduler hooks in a non-blocking context. 16786
* Dir
* Dir.glob and Dir.[] now sort the results by default, and accept the `sort:` keyword option. 8709
* ENV
* ENV.except has been added, which returns a hash excluding the given keys... -
NEWS for Ruby 2
. 3 . 0 (30.0) -
NEWS for Ruby 2.3.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。
...c-cp-us; dummy) を追加
* Enumerable
* Enumerable#grep_v を追加
11049
* Enumerable#chunk_while
10769
* Enumerator::Lazy
* Enumerator::Lazy#grep_v を追加
11773
* File
* File.mkfifo
11536
* O_TMPFILE に対応する File::TMPFILE(File::Const......ative? を追加
11151
* Proc
* Proc#call ( Proc#[] , Proc#===, Proc#yield) は最適化されました。
Backtrace doesn't show each method (show block lines directly).
TracePoint also ignores these calls.
11569
* Queue (Thread::Queue)
* 終了を通知する......ました。
=== 標準添付ライブラリの互換性 (機能追加とバグ修正を除く)
* ext/coverage/coverage.c
* Coverage.peek_result を追加。カバレッジツールを停止することなくカバレッジに関する情報を取得することができます。
https...