18件ヒット
[1-18件を表示]
(0.015秒)
種類
- クラス (6)
- 文書 (6)
- インスタンスメソッド (6)
ライブラリ
- ビルトイン (12)
クラス
-
Enumerator
:: Lazy (6)
キーワード
- Lazy (6)
-
NEWS for Ruby 2
. 7 . 0 (6)
検索結果
先頭3件
-
Enumerator
:: Lazy # filter _ map {|item| . . . } -> Enumerator :: Lazy (18147.0) -
Enumerable#filter_map と同じですが、配列ではなく Enumerator::Lazy を返します。
...Enumerable#filter_map と同じですが、配列ではなく Enumerator::Lazy を返します。
@raise ArgumentError ブロックを指定しなかった場合に発生します。
//emlist[例][ruby]{
1.step.lazy.filter_map { |n| n * 2 if n.even? }
# => #<Enumerator::Lazy: #<Enumerator::Lazy:......(1.step)>:filter_map>
1.step.lazy.filter_map { |n| n * 2 if n.even? }.take(10).force
# => [4, 8, 12, 16, 20, 24, 28, 32, 36, 40]
//}
@see Enumerable#filter_map... -
NEWS for Ruby 2
. 7 . 0 (24.0) -
NEWS for Ruby 2.7.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。
...。 15931
* Enumerable
* 新規メソッド
* Enumerable#filter_mapが追加されました。 15323
* Enumerable#tallyが追加されました。 11076
//emlist[Enumerable#filter_map][ruby]{
[1, 2, 3].filter_map {|x| x.odd? ? x.to_s : nil } #=> ["1", "3"]
//}
//emlist[Enumerable#......#=> ["FOO!?", "BAR!?", "BAZ!?"]
//}
//emlist[Enumerator::Lazy#with_index][ruby]{
("a"..).lazy.with_index(1) { |it, index| puts "#{index}:#{it}" }.take(3).force
# => 1:a
# 2:b
# 3:c
//}
* Fiber
* 新規メソッド
* Fiber#raiseメソッドが追加され、Fiber#resumeのよう... -
Enumerator
:: Lazy (18.0) -
map や select などのメソッドの遅延評価版を提供するためのクラス。
...なく Enumerator を返す) ように再定義されています。
* map/collect
* flat_map/collect_concat
* filter_map
* select/find_all
* reject
* grep, grep_v
* take, take_while
* drop, drop_while
* slice_before, slice_after, slice_when
* chunk, chunk_while
* uniq
* zip (※互換......なく Enumerator を返す) ように再定義されています。
* map/collect
* flat_map/collect_concat
* filter_map
* select/find_all
* reject
* grep, grep_v
* take, take_while
* drop, drop_while
* slice_before, slice_after, slice_when
* chunk, chunk_while
* uniq
* compact
* zip...