クラス
-
ARGF
. class (119) - Array (296)
- Complex (22)
- Dir (17)
- Enumerator (171)
-
Enumerator
:: ArithmeticSequence (84) -
Enumerator
:: Chain (30) -
Enumerator
:: Lazy (378) -
Enumerator
:: Yielder (27) - Float (22)
- Hash (152)
- IO (141)
- Integer (55)
- Numeric (73)
- Object (57)
- Range (52)
- Rational (22)
- String (73)
- Struct (39)
モジュール
- Enumerable (402)
キーワード
- % (12)
- + (6)
- << (11)
- == (6)
- begin (6)
- bsearch (22)
-
bsearch
_ index (9) - bytes (14)
- chain (6)
- chars (14)
- chunk (33)
-
chunk
_ while (19) - codepoints (14)
- collect (33)
- collect! (11)
-
collect
_ concat (22) - combination (11)
- compact (3)
- cycle (22)
-
delete
_ if (22) - denominator (55)
- detect (11)
- downto (11)
- drop (11)
-
drop
_ while (33) - each (178)
-
each
_ byte (33) -
each
_ char (33) -
each
_ child (6) -
each
_ codepoint (33) -
each
_ cons (11) -
each
_ entry (11) -
each
_ grapheme _ cluster (7) -
each
_ index (11) -
each
_ key (11) -
each
_ line (66) -
each
_ pair (22) -
each
_ slice (11) -
each
_ value (11) -
each
_ with _ index (11) -
each
_ with _ object (11) - eager (5)
- end (6)
-
enum
_ for (44) -
exclude
_ end? (6) - feed (11)
- filter (30)
- filter! (12)
-
filter
_ map (10) - find (11)
-
find
_ all (22) -
find
_ index (22) - first (12)
-
flat
_ map (22) - force (11)
- grep (11)
-
grep
_ v (9) -
group
_ by (11) - gsub (11)
- gsub! (11)
- hash (6)
- index (11)
- inspect (12)
-
keep
_ if (22) - last (12)
- lazy (22)
- lines (42)
- map (33)
- map! (11)
-
max
_ by (22) -
min
_ by (22) -
minmax
_ by (11) - next (11)
-
next
_ values (11) - partition (11)
- peek (11)
-
peek
_ values (11) - permutation (11)
- reject (44)
- reject! (22)
-
repeated
_ combination (11) -
repeated
_ permutation (11) -
reverse
_ each (23) - rewind (17)
- rindex (11)
- select (55)
- select! (22)
- size (23)
-
slice
_ after (42) -
slice
_ before (55) -
slice
_ when (21) -
sort
_ by (11) -
sort
_ by! (11) - step (74)
- take (11)
-
take
_ while (44) - then (6)
- times (11)
-
to
_ enum (44) -
to
_ proc (5) -
transform
_ keys (7) -
transform
_ keys! (7) -
transform
_ values (8) -
transform
_ values! (8) - uniq (16)
- upto (11)
-
with
_ index (32) -
with
_ object (22) - yield (11)
-
yield
_ self (7) - zip (22)
検索結果
先頭5件
- Enumerator
:: Lazy # chunk {|elt| . . . } -> Enumerator :: Lazy - Enumerator
:: Lazy # chunk(initial _ state) {|elt , state| . . . } -> Enumerator :: Lazy - Enumerator
:: Lazy # chunk _ while {|elt _ before , elt _ after| . . . } -> Enumerator :: Lazy - Enumerator
:: Lazy # collect {|item| . . . } -> Enumerator :: Lazy - Enumerator
:: Lazy # collect _ concat {|item| . . . } -> Enumerator :: Lazy
-
Enumerator
:: Lazy # chunk {|elt| . . . } -> Enumerator :: Lazy (3103.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
# => [[fa... -
Enumerator
:: Lazy # chunk(initial _ state) {|elt , state| . . . } -> Enumerator :: Lazy (3103.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
# => [[fa... -
Enumerator
:: Lazy # chunk _ while {|elt _ before , elt _ after| . . . } -> Enumerator :: Lazy (3103.0) -
Enumerable#chunk_while と同じですが、Enumerator ではなく Enumerator::Lazy を返します。
...Enumerable#chunk_while と同じですが、Enumerator ではなく Enumerator::Lazy を返します。
@raise ArgumentError ブロックを指定しなかった場合に発生します。... -
Enumerator
:: Lazy # collect {|item| . . . } -> Enumerator :: Lazy (3103.0) -
Enumerable#map と同じですが、配列ではなくEnumerator::Lazy を返します。
...ですが、配列ではなく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.collec... -
Enumerator
:: Lazy # collect _ concat {|item| . . . } -> Enumerator :: Lazy (3103.0) -
ブロックの実行結果をひとつに繋げたものに対してイテレートするような Enumerator::Lazy のインスタンスを返します。
...ブロックの実行結果をひとつに繋げたものに対してイテレートするような
Enumerator::Lazy のインスタンスを返します。
//emlist[][ruby]{
["foo", "bar"].lazy.flat_map {|i| i.each_char.lazy}.force
#=> ["f", "o", "o", "b", "a", "r"]
//}
ブロックの返した......結されます。
* x が配列であるか、to_ary メソッドを持つとき
* x が each および force メソッドを持つ (例:Enumerator::Lazy) とき
それ以外のときは、x は分解されず、そのままの値として使われます。
//emlist[][ruby]{
[{a:1}, {b:2}].l... -
Enumerator
:: Lazy # compact -> Enumerator :: Lazy (3103.0) -
Enumerable#compact と同じですが、配列ではなく Enumerator::Lazy を返します。
...Enumerable#compact と同じですが、配列ではなく Enumerator::Lazy を返します。... -
Enumerator
:: Lazy # drop(n) -> Enumerator :: Lazy (3103.0) -
Enumerable#drop と同じですが、配列ではなくEnumerator::Lazy を返します。
...、配列ではなくEnumerator::Lazy を返します。
@param n 要素数を指定します。
@raise ArgumentError n に負の数を指定した場合に発生します。
//emlist[例][ruby]{
1.step.lazy.drop(3)
# => #<Enumerator::Lazy: #<Enumerator::Lazy: #<Enumerator: 1:step>>:drop(3)>
1.s... -
Enumerator
:: Lazy # drop _ while {|item| . . . } -> Enumerator :: Lazy (3103.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... -
Enumerator
:: Lazy # eager -> Enumerator (3103.0) -
自身を遅延評価しない Enumerator に変換して返します。
...自身を遅延評価しない Enumerator に変換して返します。
//emlist[例][ruby]{
lazy_enum = (1..).each.lazy
# select が遅延評価されるので終了する
p lazy_enum.class # => Enumerator::Lazy
p lazy_enum.select { |n| n.even? }.first(5)
# => [2, 4, 6, 8, 10]
# select が遅......延評価されないので終了しない
enum = lazy_enum.eager
p enum.class # => Enumerator
p enum.select { |n| n.even? }.first(5)
//}... -
Enumerator
:: Lazy # enum _ for(method = :each , *args) -> Enumerator :: Lazy (3103.0) -
Object#to_enum と同じですが、Enumerator::Lazy を返します。
...Object#to_enum と同じですが、Enumerator::Lazy を返します。
to_enum は「ブロック付きで呼ぶとループを実行し、ブロックを省略した場合は
Enumerator を返す」ようなメソッドを定義するときによく使われます。
このときに lazy 性が......正しく引き継がれるように、Lazy#to_enum は
素のEnumerator ではなく Enumerator::Lazy を返すようになっています。
//emlist[例][ruby]{
module Enumerable
# 要素をn回ずつ繰り返すメソッド
# 例:[1,2,3].repeat(2) #=> [1,1,2,2,3,3]
def repeat(n)
ra......map{|n| n**2}.repeat(2).first(5)
#=> [1, 1, 4, 4, 9]
r = 1..Float::INFINITY
p r.lazy.map{|n| n**2}.repeat(2).first(5)
#=> [1, 1, 4, 4, 9]
# Lazy#to_enum のおかげで、repeat の返り値は
# もとが Enumerator のときは Enumerator に、
# もとが Lazy のときは Lazy になる
//}... -
Enumerator
:: Lazy # enum _ for(method = :each , *args) {|*args| block} -> Enumerator :: Lazy (3103.0) -
Object#to_enum と同じですが、Enumerator::Lazy を返します。
...Object#to_enum と同じですが、Enumerator::Lazy を返します。
to_enum は「ブロック付きで呼ぶとループを実行し、ブロックを省略した場合は
Enumerator を返す」ようなメソッドを定義するときによく使われます。
このときに lazy 性が......正しく引き継がれるように、Lazy#to_enum は
素のEnumerator ではなく Enumerator::Lazy を返すようになっています。
//emlist[例][ruby]{
module Enumerable
# 要素をn回ずつ繰り返すメソッド
# 例:[1,2,3].repeat(2) #=> [1,1,2,2,3,3]
def repeat(n)
ra......map{|n| n**2}.repeat(2).first(5)
#=> [1, 1, 4, 4, 9]
r = 1..Float::INFINITY
p r.lazy.map{|n| n**2}.repeat(2).first(5)
#=> [1, 1, 4, 4, 9]
# Lazy#to_enum のおかげで、repeat の返り値は
# もとが Enumerator のときは Enumerator に、
# もとが Lazy のときは Lazy になる
//}...