るりまサーチ (Ruby 2.7.0)

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

別のキーワード

  1. _builtin to_i
  2. fiddle to_i
  3. matrix elements_to_i
  4. csv to_i
  5. matrix i

ライブラリ

モジュール

キーワード

検索結果

Rinda::TupleSpaceProxy#take(tuple, sec = nil) -> Array | Hash (63679.0)

tuple にマッチするタプルをタプルスペースから取り出して返します。

tuple にマッチするタプルをタプルスペースから取り出して返します。

内部的にはリモートオブジェクトの Rinda::TupleSpace#take にフォワードされます。
詳細は Rinda::TupleSpace#take を参照してください。

@param tuple タプルのパターン
@param sec タイムアウト秒数
@raise Rinda::RequestExpiredError take がタイムアウトした場合に発生します
@raise Ridna::RequestCanceledError take が何らかの理由でキャンセルされた場合に発生します。

Rinda::TupleSpace#take(tuple, sec = nil) -> Array | Hash (63661.0)

tuple にマッチするタプルをタプルスペースから取り出して返します。

tuple にマッチするタプルをタプルスペースから取り出して返します。

tuple で指定できるパターンについては lib:rinda/rinda#tuplepattern を
参照してください。

マッチするタプルが存在しない場合は、マッチするタプルがタプルスペースに
投入されるまで待ちます。

sec でタイムアウト秒数を指定できます。
待ち時間が sec 秒を過ぎた時には take をあきらめ
例外 Rinda::RequestExpiredError を発生させます。
sec に nil を指定するとタイムアウトせずに無限に待ち続けます。

@param tuple タプルのパター...

Enumerator::Lazy#take_while -> Enumerator::Lazy (36730.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 (36730.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....

Array#take_while -> Enumerator (36682.0)

配列の要素を順に偽になるまでブロックで評価します。 最初に偽になった要素の手前の要素までを配列として返します。 このメソッドは自身を破壊的に変更しません。

配列の要素を順に偽になるまでブロックで評価します。
最初に偽になった要素の手前の要素までを配列として返します。
このメソッドは自身を破壊的に変更しません。

//emlist[例][ruby]{
a = [1, 2, 3, 4, 5, 0]
a.take_while {|i| i < 3 } # => [1, 2]
//}

ブロックを省略した場合は Enumerator を返します。

@see Enumerable#take_while

絞り込み条件を変える

Array#take_while {|element| ... } -> Array (36682.0)

配列の要素を順に偽になるまでブロックで評価します。 最初に偽になった要素の手前の要素までを配列として返します。 このメソッドは自身を破壊的に変更しません。

配列の要素を順に偽になるまでブロックで評価します。
最初に偽になった要素の手前の要素までを配列として返します。
このメソッドは自身を破壊的に変更しません。

//emlist[例][ruby]{
a = [1, 2, 3, 4, 5, 0]
a.take_while {|i| i < 3 } # => [1, 2]
//}

ブロックを省略した場合は Enumerator を返します。

@see Enumerable#take_while

Enumerable#take_while -> Enumerator (36682.0)

Enumerable オブジェクトの要素を順に偽になるまでブロックで評価します。 最初に偽になった要素の手前の要素までを配列として返します。

Enumerable オブジェクトの要素を順に偽になるまでブロックで評価します。
最初に偽になった要素の手前の要素までを配列として返します。

//emlist[例][ruby]{
e = [1, 2, 3, 4, 5, 0].each
e.take_while {|i| i < 3 } # => [1, 2]
//}

ブロックを省略した場合は Enumerator を返します。

@see Array#take_while

Enumerable#take_while {|element| ... } -> Array (36682.0)

Enumerable オブジェクトの要素を順に偽になるまでブロックで評価します。 最初に偽になった要素の手前の要素までを配列として返します。

Enumerable オブジェクトの要素を順に偽になるまでブロックで評価します。
最初に偽になった要素の手前の要素までを配列として返します。

//emlist[例][ruby]{
e = [1, 2, 3, 4, 5, 0].each
e.take_while {|i| i < 3 } # => [1, 2]
//}

ブロックを省略した場合は Enumerator を返します。

@see Array#take_while

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

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

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

イベントを生じさせたタプルがpattern にマッチした場合にのみ報告されます。

イベントが生じた場合、
このメソッドの返り値の Rinda::NotifyTemplateEntry を経由し、
Rinda::NotifyTemplateEntry#each を用いて報告を受け取ります。

sec で監視期間を秒数で指定できます。 nil で無限に監視し続けます。

event として以下の3つを指定できます。
* 'write' : タプルが追加された
* 'take' : タプルが take された
* 'delet...

Enumerator::Lazy#drop_while {|item| ... } -> Enumerator::Lazy (18394.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]
//...

絞り込み条件を変える

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

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

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

@raise ArgumentError ブロックを指定しなかった場合に発生します。

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

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

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

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

@raise ArgumentError ブロックを指定しなかった場合に発生します。

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

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

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

Enumerable#slice_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 }.take(5).force
# => [[1, 2]...

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

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

Enumerable#filter_map と同じですが、配列ではなく 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 { |n| n * 2 if n.even? }.take(10).fo...

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

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

Enumerable#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
# => [[1, 2, 3], [4, 5, 6], [...

絞り込み条件を変える

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

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

Enumerable#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
# => [[1, 2, 3], [4, 5, 6], [...

Enumerator::Lazy#slice_before {|elt| bool } -> Enumerator::Lazy (18322.0)

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

Enumerable#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
# => [[1, 2], [3, 4, 5], [6...

Enumerator::Lazy#slice_before(initial_state) {|elt, state| bool } -> Enumerator::Lazy (18322.0)

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

Enumerable#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
# => [[1, 2], [3, 4, 5], [6...

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

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

Enumerable#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
# => [[1, 2], [3, 4, 5], [6...

Enumerator::Lazy#with_index(offset = 0) -> Enumerator::Lazy (18322.0)

生成時のパラメータに従って、要素にインデックスを添えて繰り返します。 インデックスは offset から始まります。

生成時のパラメータに従って、要素にインデックスを添えて繰り返します。
インデックスは offset から始まります。

ブロックを指定した場合の戻り値は生成時に指定したレシーバ自身です。

//emlist[][ruby]{
("a"..).lazy.with_index(1) { |it, index| puts "#{index}:#{it}" }.take(3).force
# => 1:a
# 2:b
# 3:c
//}

@see Enumerator#with_index

絞り込み条件を変える

Enumerator::Lazy#with_index(offset = 0) {|(*args), idx| ... } -> Enumerator::Lazy (18322.0)

生成時のパラメータに従って、要素にインデックスを添えて繰り返します。 インデックスは offset から始まります。

生成時のパラメータに従って、要素にインデックスを添えて繰り返します。
インデックスは offset から始まります。

ブロックを指定した場合の戻り値は生成時に指定したレシーバ自身です。

//emlist[][ruby]{
("a"..).lazy.with_index(1) { |it, index| puts "#{index}:#{it}" }.take(3).force
# => 1:a
# 2:b
# 3:c
//}

@see Enumerator#with_index

Enumerator::Lazy#zip(*lists) -> Enumerator::Lazy (18322.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 (18322.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#select {|item| ... } -> Enumerator::Lazy (9394.0)

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

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

@raise ArgumentError ブロックを指定しなかった場合に発生します。

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

Enumerator::Lazy#reject {|item| ... } -> Enumerator::Lazy (394.0)

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

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

@raise ArgumentError ブロックを指定しなかった場合に発生します。

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

1.step.lazy.reject { |i| i.even? }.take(10).force
# => [1, 3, 5, 7, ...

絞り込み条件を変える

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

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

Enumerable#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
# => [[false, [1, 2]], [true, [3]], [false, [4, 5...

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

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

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

@raise ArgumentError ブロックを指定しなかった場合に発生します。

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

Enumerator::Lazy#grep(pattern) {|item| ... } -> Enumerator::Lazy (322.0)

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

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

//emlist[例][ruby]{
(100..Float::INFINITY).lazy.map(&:to_s).grep(/\A(\d)\1+\z/)
# => #<Enumerator::Lazy: #<Enumerator::Lazy: #<Enumerator::Lazy: 100..Infinity>:map>:grep(/\A(\d)\1+\z/)>
(100..Float::INFINITY).lazy.map(&:to_s).grep(/\A(\d)\1+\z/)....

Enumerator::Lazy#grep_v(pattern) {|item| ... } -> Enumerator::Lazy (322.0)

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

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

//emlist[例][ruby]{
(100..Float::INFINITY).lazy.map(&:to_s).grep_v(/(\d).*\1/)
# => #<Enumerator::Lazy: #<Enumerator::Lazy: #<Enumerator::Lazy: 100..Infinity>:map>:grep_v(/(\d).*\1/)>
(100..Float::INFINITY).lazy.map(&:to_s).grep_v(/(\d).*\1/).t...

Enumerator::Lazy#map {|item| ... } -> Enumerator::Lazy (322.0)

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

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

@raise ArgumentError ブロックを指定しなかった場合に発生します。

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

絞り込み条件を変える