るりまサーチ

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

別のキーワード

  1. _builtin take_while
  2. _builtin take
  3. tuple take
  4. array take_while
  5. lazy take_while

ライブラリ

モジュール

キーワード

検索結果

<< < 1 2 3 4 5 ... > >>

Rinda::TupleSpace#notify(event, pattern, sec = nil) -> Rinda::NotifyTemplateEntry (12.0)

event で指定した種類のイベントの監視を開始します。

...で無限に監視し続けます。

event として以下の3つを指定できます。
* 'write' : タプルが追加された
* 'take' : タプルが take された
* 'delete' : タプルが有効期限切れや上書きされたなどでタプルスペースから削除された
これ...

CSV (6.0)

このクラスは CSV ファイルやデータに対する完全なインターフェイスを提供します。

...s or Rows of Strings in the
Encoding of your data. This is accomplished by transcoding the parser itself
into your Encoding.

Some transcoding must take place, of course, to accomplish this multiencoding
support. For example, <tt>:col_sep</tt>, <tt>:row_sep</tt>, and
<tt>:quote_char</tt> must be t...

Enumerator.new(size=nil) {|y| ... } -> Enumerator (6.0)

Enumerator オブジェクトを生成して返します。与えられたブロックは Enumerator::Yielder オブジェクトを 引数として実行されます。

...照されます。

//emlist[例][ruby]{
enum = Enumerator.new{|y|
(1..10).each{|i|
y << i if i % 5 == 0
}
}
enum.each{|i| p i }

#=> 5
# 10


fib = Enumerator.new { |y|
a = b = 1
loop {
y << a
a, b = b, a + b
}
}

p fib.take(10) #=> [1, 1, 2, 3, 5, 8, 13, 21, 34, 55]
//}...

Enumerator.produce(initial = nil) { |prev| ... } -> Enumerator (6.0)

与えられたブロックを呼び出し続ける、停止しない Enumerator を返します。 ブロックの戻り値が、次にブロックを呼び出す時に引数として渡されます。 initial 引数が渡された場合、最初にブロックを呼び出す時にそれがブロック 呼び出しの引数として渡されます。initial が渡されなかった場合は nil が 渡されます。

...うことで、
while や until ループのような処理を実装できます。
例えば Enumerable#detect, Enumerable#slice_after, Enumerable#take_while
などと合わせて使えるでしょう。

//emlist[Enumerable のメソッドと組み合わせる例][ruby]{
# 次の火曜日を返す...

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

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

...t[例][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
# => [[false, [1, 2]], [true, [3]], [false, [4, 5]], [true, [6]], [false, [7, 8]]]
//}

@see Enumerable#chunk...

絞り込み条件を変える

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

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

...t[例][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
# => [[false, [1, 2]], [true, [3]], [false, [4, 5]], [true, [6]], [false, [7, 8]]]
//}

@see Enumerable#chunk...

Enumerator::Lazy#collect {|item| ... } -> Enumerator::Lazy (6.0)

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

...クを指定しなかった場合に発生します。

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

1.step.lazy.collect{ |n| n.succ }.take(10).force
# => [2, 3, 4, 5, 6, 7, 8, 9, 10, 11]
//}

@see Enumerable#map...

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

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

...@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, 11, 12, 13]
//}

@see Enumerable#drop...

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

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

...::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]
//}

@see Enumerable#drop_while...
...r::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]
//}

@see Enumerable#drop_while...

Enumerator::Lazy#filter {|item| ... } -> Enumerator::Lazy (6.0)

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

...なかった場合に発生します。

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

1.step.lazy.select { |i| i.even? }.take(10).force
# => [2, 4, 6, 8, 10, 12, 14, 16, 18, 20]
//}

@see Enumerable#select...

絞り込み条件を変える

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

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

...に発生します。

//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...

Enumerator::Lazy#find_all {|item| ... } -> Enumerator::Lazy (6.0)

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

...なかった場合に発生します。

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

1.step.lazy.select { |i| i.even? }.take(10).force
# => [2, 4, 6, 8, 10, 12, 14, 16, 18, 20]
//}

@see Enumerable#select...
<< < 1 2 3 4 5 ... > >>