種類
- インスタンスメソッド (27)
- クラス (2)
- モジュール関数 (1)
- 特異メソッド (1)
ライブラリ
- ビルトイン (26)
-
rinda
/ rinda (3) -
rinda
/ tuplespace (2)
クラス
- Array (2)
- Enumerator (1)
-
Enumerator
:: Lazy (20) -
Rinda
:: TupleSpace (2) -
Rinda
:: TupleSpaceProxy (1)
モジュール
- Enumerable (2)
- ObjectSpace (1)
キーワード
- RequestCanceledError (1)
- TupleSpaceProxy (1)
- chunk (1)
- collect (1)
-
drop
_ while (1) -
each
_ object (1) - filter (1)
-
find
_ all (1) - grep (1)
-
grep
_ v (1) - map (1)
- new (1)
- notify (1)
- reject (1)
- select (1)
-
slice
_ after (2) -
slice
_ before (3) -
slice
_ when (1) -
take
_ while (6) - zip (2)
検索結果
先頭5件
-
Rinda
:: TupleSpaceProxy # take(tuple , sec = nil) -> Array | Hash (72976.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 (72958.0) -
tuple にマッチするタプルをタプルスペースから取り出して返します。
tuple にマッチするタプルをタプルスペースから取り出して返します。
tuple で指定できるパターンについては lib:rinda/rinda#tuplepattern を
参照してください。
マッチするタプルが存在しない場合は、マッチするタプルがタプルスペースに
投入されるまで待ちます。
sec でタイムアウト秒数を指定できます。
待ち時間が sec 秒を過ぎた時には take をあきらめ
例外 Rinda::RequestExpiredError を発生させます。
sec に nil を指定するとタイムアウトせずに無限に待ち続けます。
@param tuple タプルのパター... -
Enumerable
# take _ while {|element| . . . } -> Array (64279.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 -> Enumerator (63979.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 -
Array
# take _ while {|element| . . . } -> Array (55279.0) -
配列の要素を順に偽になるまでブロックで評価します。 最初に偽になった要素の手前の要素までを配列として返します。 このメソッドは自身を破壊的に変更しません。
配列の要素を順に偽になるまでブロックで評価します。
最初に偽になった要素の手前の要素までを配列として返します。
このメソッドは自身を破壊的に変更しません。
//emlist[例][ruby]{
a = [1, 2, 3, 4, 5, 0]
a.take_while {|i| i < 3 } # => [1, 2]
//}
ブロックを省略した場合は Enumerator を返します。
@see Enumerable#take_while -
Enumerator
:: Lazy # take _ while -> Enumerator :: Lazy (55027.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 (55027.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 (54979.0) -
配列の要素を順に偽になるまでブロックで評価します。 最初に偽になった要素の手前の要素までを配列として返します。 このメソッドは自身を破壊的に変更しません。
配列の要素を順に偽になるまでブロックで評価します。
最初に偽になった要素の手前の要素までを配列として返します。
このメソッドは自身を破壊的に変更しません。
//emlist[例][ruby]{
a = [1, 2, 3, 4, 5, 0]
a.take_while {|i| i < 3 } # => [1, 2]
//}
ブロックを省略した場合は Enumerator を返します。
@see Enumerable#take_while -
Enumerator
:: Lazy # drop _ while {|item| . . . } -> Enumerator :: Lazy (36691.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 (36691.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 (36691.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 (36691.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 # slice _ after {|elt| bool } -> Enumerator :: Lazy (36619.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 (36619.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 (36619.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 (36619.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 (36619.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... -
Rinda
:: TupleSpace # notify(event , pattern , sec = nil) -> Rinda :: NotifyTemplateEntry (27937.0) -
event で指定した種類のイベントの監視を開始します。
event で指定した種類のイベントの監視を開始します。
イベントを生じさせたタプルがpattern にマッチした場合にのみ報告されます。
イベントが生じた場合、
このメソッドの返り値の Rinda::NotifyTemplateEntry を経由し、
Rinda::NotifyTemplateEntry#each を用いて報告を受け取ります。
sec で監視期間を秒数で指定できます。 nil で無限に監視し続けます。
event として以下の3つを指定できます。
* 'write' : タプルが追加された
* 'take' : タプルが take された
* 'delet... -
Enumerator
:: Lazy # select {|item| . . . } -> Enumerator :: Lazy (27691.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 # zip(*lists) -> Enumerator :: Lazy (27619.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 (27619.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)... -
Rinda
:: RequestCanceledError (27049.0) -
rinda で take などのリクエストが何らかの理由でキャンセルされた ことを意味する例外クラス。
rinda で take などのリクエストが何らかの理由でキャンセルされた
ことを意味する例外クラス。 -
Rinda
:: TupleSpaceProxy (27019.0) -
リモートの Rinda::TupleSpace オブジェクトを包む プロクシクラスです。
リモートの Rinda::TupleSpace オブジェクトを包む
プロクシクラスです。
Rinda::TupleSpace#take でタプルの受け渡し時にタプルが
消失する可能性を下げるためのプロクシクラスです。 -
Enumerator
:: Lazy # collect {|item| . . . } -> Enumerator :: Lazy (18619.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 # reject {|item| . . . } -> Enumerator :: Lazy (9691.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 (9619.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 # grep(pattern) {|item| . . . } -> Enumerator :: Lazy (9619.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 (9619.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 (9619.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
. new(size=nil) {|y| . . . } -> Enumerator (709.0) -
Enumerator オブジェクトを生成して返します。与えられたブロックは Enumerator::Yielder オブジェクトを 引数として実行されます。
Enumerator オブジェクトを生成して返します。与えられたブロックは Enumerator::Yielder オブジェクトを
引数として実行されます。
生成された Enumerator オブジェクトに対して each を呼ぶと、この生成時に指定されたブロックを
実行し、Yielder オブジェクトに対して << メソッドが呼ばれるたびに、
each に渡されたブロックが繰り返されます。
new に渡されたブロックが終了した時点で each の繰り返しが終わります。
このときのブロックの返り値が each の返り値となります。
@param size 生成する Enumerator... -
ObjectSpace
. # each _ object(klass) {|object| . . . } -> Integer (619.0) -
指定された klass と Object#kind_of? の関係にある全ての オブジェクトに対して繰り返します。引数が省略された時には全てのオブ ジェクトに対して繰り返します。 繰り返した数を返します。
指定された klass と Object#kind_of? の関係にある全ての
オブジェクトに対して繰り返します。引数が省略された時には全てのオブ
ジェクトに対して繰り返します。
繰り返した数を返します。
ブロックが与えられなかった場合は、
Enumerator オブジェクトを返します。
次のクラスのオブジェクトについては繰り返しません
* Fixnum
* Symbol
* TrueClass
* FalseClass
* NilClass
とくに、klass に Fixnum や Symbol などのクラスを指定した場合は、
何も繰り返さないことになります。
なお、Sy...