るりまサーチ

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

別のキーワード

  1. enumerator each
  2. each enumerator
  3. enumerator with_index
  4. enumerator with_object
  5. enumerator new

ライブラリ

クラス

キーワード

検索結果

<< < ... 2 3 4 5 6 > >>

Enumerator::Lazy#slice_before(pattern) -> Enumerator::Lazy (3149.0)

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

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

//emlist[例][ruby]{
1.step.lazy.slice_before { |e| e.even? }
# => #<Enumerator::Lazy: #<Enumerator: #<Enumerator::Generator:0x00007f9f31844ce8>:each>>

1.step.lazy.slice_before { |e| e % 3 == 0 }.take(5).force...

Enumerator::Lazy#chunk {|elt| ... } -> Enumerator::Lazy (3148.0)

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

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

//emlist[例][ruby]{
1.step.lazy.chunk{ |n| n % 3 == 0 }
# => #<Enumerator::Lazy: #<Enumerator: #<Enumerator::Generator:0x007f8bf18118f0>:each>>

1.step.lazy.chunk{ |n| n % 3 == 0 }.take(5).force
# => [[fals...

Enumerator::Lazy#chunk(initial_state) {|elt, state| ... } -> Enumerator::Lazy (3148.0)

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

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

//emlist[例][ruby]{
1.step.lazy.chunk{ |n| n % 3 == 0 }
# => #<Enumerator::Lazy: #<Enumerator: #<Enumerator::Generator:0x007f8bf18118f0>:each>>

1.step.lazy.chunk{ |n| n % 3 == 0 }.take(5).force
# => [[fals...

Enumerator::Lazy#slice_after {|elt| bool } -> Enumerator::Lazy (3148.0)

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

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

//emlist[例][ruby]{
1.step.lazy.slice_after { |e| e % 3 == 0 }
# => #<Enumerator::Lazy: #<Enumerator: #<Enumerator::Generator:0x007fd73980e6f8>:each>>

1.step.lazy.slice_after { |e| e % 3 == 0 }.take(5).force...

Enumerator::Lazy#slice_after(pattern) -> Enumerator::Lazy (3148.0)

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

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

//emlist[例][ruby]{
1.step.lazy.slice_after { |e| e % 3 == 0 }
# => #<Enumerator::Lazy: #<Enumerator: #<Enumerator::Generator:0x007fd73980e6f8>:each>>

1.step.lazy.slice_after { |e| e % 3 == 0 }.take(5).force...

絞り込み条件を変える

Enumerator::Lazy#filter_map {|item| ... } -> Enumerator::Lazy (3147.0)

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

...列ではなく 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 {...

Enumerator::Lazy#slice_when {|elt_before, elt_after| bool } -> Enumerator::Lazy (3147.0)

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

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

//emlist[例][ruby]{
1.step.lazy.slice_when { |i, j| (i + j) % 5 == 0 }
# => #<Enumerator::Lazy: #<Enumerator: #<Enumerator::Generator:0x00007fce84118348>:each>>

1.step.lazy.slice_when { |i, j| (i + j) % 5 == 0 }.t...

Enumerator::Lazy#zip(*lists) {|v1, v2, ...| ... } -> nil (3059.0)

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

...なくEnumerator::Lazy を返します。

ただし一貫性のため、ブロック付きで呼び出した場合は Enumerable#zip と
同じ挙動になります。

//emlist[例][ruby]{
1.step.lazy.zip(('a'..'z').cycle)
# => #<Enumerator::Lazy: #<Enumerator::Lazy: #<Enumerator: 1:step>>:zip(#<E...
...numerator: "a".."z":cycle>)>

1.step.lazy.zip(('a'..'z').cycle).take(30).force.last(6)
# => [[25, "y"], [26, "z"], [27, "a"], [28, "b"], [29, "c"], [30, "d"]]
//}

@see Enumerable#zip...

Enumerator::Lazy (3036.0)

map や select などのメソッドの遅延評価版を提供するためのクラス。

...のメソッドの遅延評価版を提供するためのクラス。

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

* map/collect
* flat_map/collect_co...
...成されます。

Lazyから値を取り出すには、Enumerator::Lazy#force または
Enumerable#first を呼びます。

//emlist[例][ruby]{
# 二乗して偶数になるような整数を、小さい方から5個表示する
p 1.step.lazy.select{|n| (n**2).even?}.first(5)
# LTSV (http://ltsv...
....org/) 形式のログファイルから検索を行う
# Enumerator::Lazy#map は配列ではなく Enumerator を返すため、
# 巨大な配列を確保しようとしてメモリを使い切ったりはしない
open("log.txt"){|f|
f.each_line.lazy.map{|line|
Hash[line.split(/\t/).map{|s...

Enumerator::ArithmeticSequence (3012.0)

等差数列を提供するためのクラス。

...等差数列を提供するためのクラス。

ArithmeticSequenceオブジェクトは、Numeric#step, Range#step によって生成されます。...

絞り込み条件を変える

Enumerator::Lazy#force(*args) -> [object] (3012.0)

全ての要素を含む配列を返します。Lazy から実際に値を取り出すのに使います。

...要素を含む配列を返します。Lazy から実際に値を取り出すのに使います。

Enumerable#to_a のエイリアスです。

//emlist[例][ruby]{
1.step.lazy.take(10).force
# => [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]

1.step.lazy.take(10).to_a
# => [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
//}...
<< < ... 2 3 4 5 6 > >>