るりまサーチ (Ruby 2.6.0)

最速Rubyリファレンスマニュアル検索!
3件ヒット [1-3件を表示] (0.029秒)

別のキーワード

  1. enumerable min_by
  2. enumerable max_by
  3. enumerable max
  4. enumerable min
  5. enumerable reduce

ライブラリ

クラス

モジュール

キーワード

検索結果

Enumerable#lazy -> Enumerator::Lazy (63094.0)

自身を lazy な Enumerator に変換したものを返します。

自身を lazy な Enumerator に変換したものを返します。

この Enumerator は、以下のメソッドが遅延評価を行う (つまり、配列ではな
くEnumeratorを返す) ように再定義されています。

* map/collect
* flat_map/collect_concat
* select/find_all
* reject
* grep
* take, take_while
* drop, drop_while
* zip (※一貫性のため、ブロックを渡さないケースのみlazy)
* cycle (※一貫性のため、ブロックを渡さないケースのみl...

Enumerator::Lazy#drop(n) -> Enumerator::Lazy (54511.0)

Enumerable#drop と同じですが、配列ではなくEnumerator::Lazy を返します。

Enumerable#drop と同じですが、配列ではなくEnumerator::Lazy を返します。

@param n 要素数を指定します。

@raise ArgumentError n に負の数を指定した場合に発生します。

//emlist[例][ruby]{
1.step.lazy.drop(3)
# => #<Enumerator::Lazy: #<Enumerator::Lazy: #<Enumerator: 1:step>>:drop(3)>

1.step.lazy.drop(3).take(10).force
# => [4, 5, 6, 7, 8, 9, 10, 1...

Enumerator::Lazy#drop_while {|item| ... } -> Enumerator::Lazy (18511.0)

Enumerable#drop_while と同じですが、配列ではなくEnumerator::Lazy を返します。

Enumerable#drop_while と同じですが、配列ではなくEnumerator::Lazy を返します。

//emlist[例][ruby]{
1.step.lazy.drop_while { |i| i < 42 }
# => #<Enumerator::Lazy: #<Enumerator::Lazy: #<Enumerator: 1:step>>:drop_while>

1.step.lazy.drop_while { |i| i < 42 }.take(10).force
# => [42, 43, 44, 45, 46, 47, 48, 49, 50, 51]
//...