種類
- インスタンスメソッド (2733)
- 特異メソッド (312)
- クラス (56)
- モジュール関数 (55)
ライブラリ
クラス
-
ARGF
. class (119) - Addrinfo (11)
- Array (296)
- Complex (22)
- Date (33)
- Dir (53)
- Enumerator (194)
-
Enumerator
:: ArithmeticSequence (84) -
Enumerator
:: Chain (36) -
Enumerator
:: Lazy (389) -
Enumerator
:: Yielder (27) -
Etc
:: Group (11) -
Etc
:: Passwd (11) - Float (22)
-
Gem
:: SourceIndex (11) - Hash (152)
- IO (152)
- Integer (66)
- Matrix (85)
- Numeric (73)
- Object (57)
- OpenStruct (11)
- Pathname (57)
- Prime (22)
-
Prime
:: PseudoPrimeGenerator (33) -
Psych
:: Nodes :: Node (11) -
REXML
:: Parent (44) - Range (51)
- Rational (22)
- String (73)
- StringIO (83)
- Struct (39)
- Vector (67)
-
Zlib
:: GzipReader (33)
モジュール
- Enumerable (402)
- Find (11)
- Kernel (22)
- ObjectSpace (22)
- TSort (60)
オブジェクト
- ENV (122)
-
Readline
:: HISTORY (11)
キーワード
- % (12)
- + (6)
- << (11)
- == (6)
- ArithmeticSequence (6)
- Chain (6)
- Enumerator (11)
- Lazy (11)
- Numeric (11)
- Yielder (11)
- ascend (11)
- begin (6)
- bsearch (22)
-
bsearch
_ index (9) - bytes (21)
- chain (6)
- chars (21)
- chunk (33)
-
chunk
_ while (19) - codepoints (21)
- collect (55)
- collect! (23)
- collect2 (11)
-
collect
_ concat (22) - combination (11)
- combine (7)
- compact (3)
- cycle (22)
-
delete
_ if (44) - denominator (55)
- descend (11)
- detect (11)
- downto (22)
- drop (11)
-
drop
_ while (33) - each (321)
- each2 (11)
-
each
_ byte (55) -
each
_ char (44) -
each
_ child (42) -
each
_ codepoint (44) -
each
_ cons (11) -
each
_ entry (13) -
each
_ grapheme _ cluster (7) -
each
_ index (22) -
each
_ key (22) -
each
_ line (99) -
each
_ object (22) -
each
_ pair (44) -
each
_ prime (11) -
each
_ slice (11) -
each
_ strongly _ connected _ component (20) -
each
_ strongly _ connected _ component _ from (20) -
each
_ value (22) -
each
_ with _ index (33) -
each
_ with _ object (11) - eager (5)
- end (6)
-
enum
_ for (44) -
exclude
_ end? (6) - feed (11)
- filter (36)
- filter! (18)
-
filter
_ map (10) - find (33)
-
find
_ all (22) -
find
_ index (33) - first (12)
-
flat
_ map (22) - force (11)
- foreach (44)
- grep (11)
-
grep
_ v (9) -
group
_ by (11) - gsub (22)
- gsub! (11)
- hash (6)
- index (22)
- inspect (12)
-
keep
_ if (33) - last (12)
- lazy (22)
- lines (49)
- loop (11)
- map (55)
- map! (23)
-
max
_ by (22) -
min
_ by (22) -
minmax
_ by (11) - new (35)
- next (11)
-
next
_ values (11) - partition (11)
- peek (11)
-
peek
_ values (11) - permutation (11)
- produce (5)
- reject (55)
- reject! (33)
-
repeated
_ combination (11) -
repeated
_ permutation (11) -
reverse
_ each (22) - rewind (17)
- rindex (11)
- select (66)
- select! (33)
- size (23)
-
slice
_ after (42) -
slice
_ before (55) -
slice
_ when (21) -
sort
_ by (11) -
sort
_ by! (11) - step (85)
- 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) -
tsort
_ each (20) - uniq (16)
- upto (22)
-
with
_ index (43) -
with
_ object (33) - yield (11)
-
yield
_ self (7) - zip (22)
検索結果
先頭5件
-
Enumerator
:: Lazy # drop(n) -> Enumerator :: Lazy (3100.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 (3100.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 (3100.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 (3100.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 (3100.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 # filter {|item| . . . } -> Enumerator :: Lazy (3100.0) -
Enumerable#select と同じですが、配列ではなくEnumerator::Lazy を返します。
...ですが、配列ではなく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.laz... -
Enumerator
:: Lazy # filter _ map {|item| . . . } -> Enumerator :: Lazy (3100.0) -
Enumerable#filter_map と同じですが、配列ではなく Enumerator::Lazy を返します。
...じですが、配列ではなく 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... -
Enumerator
:: Lazy # find _ all {|item| . . . } -> Enumerator :: Lazy (3100.0) -
Enumerable#select と同じですが、配列ではなくEnumerator::Lazy を返します。
...ですが、配列ではなく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.laz... -
Enumerator
:: Lazy # flat _ map {|item| . . . } -> Enumerator :: Lazy (3100.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 # grep(pattern) {|item| . . . } -> Enumerator :: Lazy (3100.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::INFINIT......Y).lazy.map(&:to_s).grep(/\A(\d)\1+\z/).take(10).force
# => ["111", "222", "333", "444", "555", "666", "777", "888", "999", "1111"]
//}
@see Enumerable#grep, Enumerable#grep_v, Enumerator::Lazy#grep_v... -
Enumerator
:: Lazy # grep _ v(pattern) {|item| . . . } -> Enumerator :: Lazy (3100.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::INFINIT......Y).lazy.map(&:to_s).grep_v(/(\d).*\1/).take(15).force
# => ["102", "103", "104", "105", "106", "107", "108", "109", "120", "123", "124", "125", "126", "127", "128"]
//}
@see Enumerable#grep_v, Enumerable#grep, Enumerator::Lazy#grep... -
Enumerator
:: Lazy # map {|item| . . . } -> Enumerator :: Lazy (3100.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...