るりまサーチ (Ruby 2.3.0)

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

別のキーワード

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

クラス

モジュール

キーワード

検索結果

Enumerator::Lazy#zip(*lists) -> Enumerator::Lazy (63874.0)

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

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

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

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

1.step.lazy.zip(('a'..'z').cycle)...

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

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

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

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

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

1.step.lazy.zip(('a'..'z').cycle)...

Enumerator::Lazy#take_while -> Enumerator::Lazy (9505.0)

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

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

//emlist[例][ruby]{
1.step.lazy.zip(('a'..'z').cycle).take_while { |e| e.first < 100_000 }
# => #<Enumerator::Lazy: #<Enumerator::Lazy: #<Enumerator::Lazy: #<Enumerator: 1:step>>:zip(#<Enumerator: "a".."z":cycle>)>:take_while>

1.step.lazy....

Enumerator::Lazy#take_while {|item| ... } -> Enumerator::Lazy (9505.0)

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

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

//emlist[例][ruby]{
1.step.lazy.zip(('a'..'z').cycle).take_while { |e| e.first < 100_000 }
# => #<Enumerator::Lazy: #<Enumerator::Lazy: #<Enumerator::Lazy: #<Enumerator: 1:step>>:zip(#<Enumerator: "a".."z":cycle>)>:take_while>

1.step.lazy....

Enumerator::Lazy (9115.0)

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

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

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

* map/collect
* flat_map/collect_concat
* select/find_all
* reject
* grep, grep_v
* take, take_while
* drop, drop_while
* slice_before, slice_after, slice_when
* chunk...

絞り込み条件を変える

Enumerable#lazy -> Enumerator::Lazy (430.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...

Struct#each -> Enumerator (328.0)

構造体の各メンバに対して繰り返します。

構造体の各メンバに対して繰り返します。

[注意] 本メソッドの記述は Struct の下位クラスのインスタンスに対して呼び
出す事を想定しています。Struct.new は Struct の下位クラスを作成する点に
注意してください。

//emlist[例][ruby]{
Customer = Struct.new(:name, :address, :zip)
joe = Customer.new("Joe Smith", "123 Maple, Anytown NC", 12345)
joe.each {|x| puts(x) }

# => Joe Smith
# 123 Map...

Struct#each {|value| ... } -> self (28.0)

構造体の各メンバに対して繰り返します。

構造体の各メンバに対して繰り返します。

[注意] 本メソッドの記述は Struct の下位クラスのインスタンスに対して呼び
出す事を想定しています。Struct.new は Struct の下位クラスを作成する点に
注意してください。

//emlist[例][ruby]{
Customer = Struct.new(:name, :address, :zip)
joe = Customer.new("Joe Smith", "123 Maple, Anytown NC", 12345)
joe.each {|x| puts(x) }

# => Joe Smith
# 123 Map...