るりまサーチ

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

別のキーワード

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

ライブラリ

モジュール

キーワード

検索結果

<< 1 2 > >>

Enumerator::ArithmeticSequence#last -> Numeric | nil (21103.0)

等差数列の最後の要素、もしくは最後の n 要素を返します。

等差数列の最後の要素、もしくは最後の n 要素を返します。

@param n 取得する要素数。

Enumerator::ArithmeticSequence#last(n) -> [Numeric] (21103.0)

等差数列の最後の要素、もしくは最後の n 要素を返します。

等差数列の最後の要素、もしくは最後の n 要素を返します。

@param n 取得する要素数。

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

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

...じですが、配列ではなく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.zip(('a'..'z').cycle).take_while { |e| e.first < 100_000 }.force.last(5)
# => [[99995, "y"], [99996, "z"], [99997, "a"], [99998, "b"], [99999, "c"]]
//}

@see Enumerable#take_while...

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

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

...じですが、配列ではなく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.zip(('a'..'z').cycle).take_while { |e| e.first < 100_000 }.force.last(5)
# => [[99995, "y"], [99996, "z"], [99997, "a"], [99998, "b"], [99999, "c"]]
//}

@see Enumerable#take_while...

Enumerator::Lazy#zip(*lists) -> Enumerator::Lazy (3148.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>>:z...
...ip(#<Enumerator: "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#zip(*lists) {|v1, v2, ...| ... } -> nil (3048.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>>:z...
...ip(#<Enumerator: "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...

Enumerable#chunk_while {|elt_before, elt_after| ... } -> Enumerator (130.0)

要素を前から順にブロックで評価し、その結果によって要素をチャンクに分け た(グループ化した)要素を持つEnumerator を返します。

...素を前から順にブロックで評価し、その結果によって要素をチャンクに分け
た(グループ化した)要素を持つEnumerator を返します。

隣り合う値をブロックパラメータ elt_before、elt_after に渡し、ブロックの
評価値が偽になる所...
...

ブロックは self の長さ - 1 回呼び出されます。

@return チャンクごとの配列をブロックパラメータに渡す Enumerator
を返します。eachメソッドは以下のように呼び出します。
//emlist{
enum.chunk_while { |elt_before, elt_after| bool...
...unk_while {|i, j| i+1 == j }
p b.to_a # => [[1, 2], [4], [9, 10, 11, 12], [15, 16], [19, 20, 21]]
c = b.map {|a| a.length < 3 ? a : "#{a.first}-#{a.last}" }
p c # => [[1, 2], [4], "9-12", [15, 16], "19-21"]
d = c.join(",")
p d # => "1,2,4,9-12,15,16,19-21"

# 増加のみの部分配列ごとに分...

Enumerable#slice_when {|elt_before, elt_after| bool } -> Enumerator (130.0)

要素を前から順にブロックで評価し、その結果によって要素をチャンクに分け た(グループ化した)要素を持つEnumerator を返します。

...素を前から順にブロックで評価し、その結果によって要素をチャンクに分け
た(グループ化した)要素を持つEnumerator を返します。

隣り合う値をブロックパラメータ elt_before、elt_after に渡し、ブロックの
評価値が真になる所...
...

ブロックは self の長さ - 1 回呼び出されます。

@return チャンクごとの配列をブロックパラメータに渡す Enumerator
を返します。eachメソッドは以下のように呼び出します。
//emlist{
enum.slice_when { |elt_before, elt_after| bool }...
...lice_when {|i, j| i+1 != j }
p b.to_a # => [[1, 2], [4], [9, 10, 11, 12], [15, 16], [19, 20, 21]]
c = b.map {|a| a.length < 3 ? a : "#{a.first}-#{a.last}" }
p c # => [[1, 2], [4], "9-12", [15, 16], "19-21"]
d = c.join(",")
p d # => "1,2,4,9-12,15,16,19-21"

# ソート済の配列を近い値(差が...

Enumerable#slice_after {|elt| bool } -> Enumerator (125.0)

パターンがマッチした要素、もしくはブロックが真を返した要素を末尾の要素 としてチャンク化(グループ化)したものを繰り返す Enumerator を 返し ます。

...要素、もしくはブロックが真を返した要素を末尾の要素
としてチャンク化(グループ化)したものを繰り返す Enumerator を 返し
ます。

パターンを渡した場合は各要素に対し === が呼び出され、 それが真になった
ところをチャ...
...(/(?<!\\)\n\z/)
p e.to_a
#=> [["foo\n"], ["bar\\\n", "baz\n"], ["\n"], ["qux\n"]]
p e.map {|ll| ll[0...-1].map {|l| l.sub(/\\\n\z/, "") }.join + ll.last }
#=>["foo\n", "barbaz\n", "\n", "qux\n"]
//}

Enumerable#map のようなメソッドを使うこともできます。

@see Enumerable#chunk, Enu...

Enumerable#slice_after(pattern) -> Enumerator (125.0)

パターンがマッチした要素、もしくはブロックが真を返した要素を末尾の要素 としてチャンク化(グループ化)したものを繰り返す Enumerator を 返し ます。

...要素、もしくはブロックが真を返した要素を末尾の要素
としてチャンク化(グループ化)したものを繰り返す Enumerator を 返し
ます。

パターンを渡した場合は各要素に対し === が呼び出され、 それが真になった
ところをチャ...
...(/(?<!\\)\n\z/)
p e.to_a
#=> [["foo\n"], ["bar\\\n", "baz\n"], ["\n"], ["qux\n"]]
p e.map {|ll| ll[0...-1].map {|l| l.sub(/\\\n\z/, "") }.join + ll.last }
#=>["foo\n", "barbaz\n", "\n", "qux\n"]
//}

Enumerable#map のようなメソッドを使うこともできます。

@see Enumerable#chunk, Enu...

絞り込み条件を変える

<< 1 2 > >>