種類
- インスタンスメソッド (1758)
- 特異メソッド (247)
- モジュール関数 (48)
- クラス (36)
ライブラリ
クラス
-
ARGF
. class (31) - Addrinfo (12)
- Array (168)
- CSV (12)
- Complex (24)
- Date (24)
- Dir (59)
- Enumerator (157)
-
Enumerator
:: ArithmeticSequence (14) -
Enumerator
:: Chain (7) -
Enumerator
:: Lazy (193) -
Enumerator
:: Yielder (30) -
Etc
:: Group (12) -
Etc
:: Passwd (12) - Hash (101)
- IO (115)
- Integer (24)
- Matrix (38)
- Numeric (57)
- Object (48)
- OpenStruct (12)
- Pathname (63)
- Prime (24)
-
Prime
:: PseudoPrimeGenerator (36) -
Psych
:: Nodes :: Node (12) -
REXML
:: Parent (48) - Range (35)
- String (68)
- StringIO (69)
- Struct (12)
- Vector (50)
-
Zlib
:: GzipReader (36)
モジュール
- Enumerable (282)
- Kernel (24)
- ObjectSpace (24)
- TSort (55)
オブジェクト
- ENV (53)
-
Readline
:: HISTORY (12)
キーワード
- % (14)
- << (12)
- Enumerator (12)
- Lazy (12)
- Numeric (12)
- ascend (12)
- bytes (7)
- chunk (12)
-
chunk
_ while (12) - codepoints (21)
- collect (48)
- collect! (26)
- collect2 (12)
- compact (4)
-
delete
_ if (36) - denominator (12)
- descend (12)
- detect (12)
- drop (12)
-
drop
_ while (36) - each (228)
-
each
_ byte (48) -
each
_ char (12) -
each
_ child (47) -
each
_ codepoint (48) -
each
_ cons (12) -
each
_ entry (3) -
each
_ grapheme _ cluster (8) -
each
_ index (12) -
each
_ key (24) -
each
_ line (84) -
each
_ object (24) -
each
_ pair (48) -
each
_ prime (12) -
each
_ slice (12) -
each
_ strongly _ connected _ component (22) -
each
_ strongly _ connected _ component _ from (22) -
each
_ value (12) -
each
_ with _ index (24) - eager (6)
-
enum
_ for (48) - feed (12)
-
filter
_ map (12) - find (24)
-
find
_ index (12) -
flat
_ map (24) - foreach (60)
- grep (12)
-
grep
_ v (10) -
group
_ by (12) - gsub (24)
- gsub! (12)
- index (12)
- inspect (14)
-
keep
_ if (36) - lazy (24)
- lines (7)
- loop (12)
- map (60)
- map! (26)
-
max
_ by (24) - new (19)
-
next
_ values (12) - partition (12)
- peek (12)
-
peek
_ values (12) - permutation (12)
- produce (6)
- reject (12)
- reject! (24)
-
repeated
_ combination (12) -
repeated
_ permutation (12) -
reverse
_ each (14) - rewind (12)
- rindex (12)
- select! (10)
-
slice
_ after (35) -
slice
_ before (36) -
slice
_ when (12) -
sort
_ by (12) - step (95)
-
to
_ enum (48) -
to
_ proc (6) -
tsort
_ each (11) - upto (24)
-
with
_ index (36) -
with
_ object (12) - yield (12)
- zip (24)
検索結果
先頭5件
-
Complex
# numerator -> Complex (21213.0) -
分子を返します。
...分子を返します。
//emlist[例][ruby]{
Complex('1/2+2/3i').numerator # => (3+4i)
Complex(3).numerator # => (3+0i)
//}
@see Complex#denominator... -
Array
# repeated _ permutation(n) -> Enumerator (12301.0) -
サイズ n の重複順列をすべて生成し,それを引数としてブロックを実行します。
...生成する Enumerator オブジェクトを返します。
@param n 生成する配列のサイズを整数で指定します。
整数以外のオブジェクトを指定した場合は to_int メソッドによる暗
黙の型変換を試みます。
@raise TypeError 引数......a.repeated_permutation(1).to_a #=> [[1], [2]]
a.repeated_permutation(2).to_a #=> [[1,1],[1,2],[2,1],[2,2]]
a.repeated_permutation(3).to_a #=> [[1,1,1],[1,1,2],[1,2,1],[1,2,2],
# [2,1,1],[2,1,2],[2,2,1],[2,2,2]]
a.repeated_permutation(0).to_a #=> [[]] # one perm......ロックを実
行して self を返します。
//emlist[例][ruby]{
a = [1, 2]
result = []
a.repeated_permutation(3) {|e| result << e} # => [1,2]
result #=> [[1,1,1],[1,1,2],[1,2,1],[1,2,2],
# [2,1,1],[2,1,2],[2,2,1],[2,2,2]]
//}
@see Array#repeated_combination, Array#permutation... -
Enumerator
. produce(initial = nil) { |prev| . . . } -> Enumerator (9300.0) -
与えられたブロックを呼び出し続ける、停止しない Enumerator を返します。 ブロックの戻り値が、次にブロックを呼び出す時に引数として渡されます。 initial 引数が渡された場合、最初にブロックを呼び出す時にそれがブロック 呼び出しの引数として渡されます。initial が渡されなかった場合は nil が 渡されます。
...与えられたブロックを呼び出し続ける、停止しない Enumerator を返します。
ブロックの戻り値が、次にブロックを呼び出す時に引数として渡されます。
initial 引数が渡された場合、最初にブロックを呼び出す時にそれがブロ......ブロックが例外 StopIterationを投げた場合、繰り返しが終了します。
@param initial ブロックに最初に渡される値です。任意のオブジェクトを渡せます。
//emlist[例][ruby]{
# 1, 2, 3, 4, ... と続く Enumerator
Enumerator.produce(1, &:succ)
# next......ンダムな数値を返す Enumerator
Enumerator.produce { rand(10) }
# ツリー構造の祖先ノードを列挙する Enumerator
ancestors = Enumerator.produce(node) { |prev| node = prev.parent or raise StopIteration }
enclosing_section = ancestors.find { |n| n.type == :section }
//}
このメ... -
Enumerator
:: Yielder # to _ proc -> Proc (9206.0) -
Enumerator.new で使うメソッドです。
...Enumerator.new で使うメソッドです。
引数を Enumerator::Yielder#yield に渡す Proc を返します。
これは Enumerator::Yielder オブジェクトを他のメソッドにブロック引数と
して直接渡すために使えます。
//emlist[例][ruby]{
text = <<-END
Hello
こ......んにちは
END
enum = Enumerator.new do |y|
text.each_line(&y)
end
enum.each do |line|
p line
end
# => "Hello\n"
# "こんにちは\n"
//}... -
Enumerator
:: Lazy # compact -> Enumerator :: Lazy (9200.0) -
Enumerable#compact と同じですが、配列ではなく Enumerator::Lazy を返します。
...Enumerable#compact と同じですが、配列ではなく Enumerator::Lazy を返します。... -
Enumerator
:: Lazy # drop(n) -> Enumerator :: Lazy (9200.0) -
Enumerable#drop と同じですが、配列ではなくEnumerator::Lazy を返します。
...rop と同じですが、配列ではなくEnumerator::Lazy を返します。
@param n 要素数を指定します。
@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 (9200.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]
//}
@see Enumerable#drop_while... -
Enumerator
:: Lazy # filter _ map {|item| . . . } -> Enumerator :: Lazy (9200.0) -
Enumerable#filter_map と同じですが、配列ではなく Enumerator::Lazy を返します。
...ap と同じですが、配列ではなく 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).force
# => [4, 8, 12, 16, 20, 24, 28, 32, 36, 40]
//}
@see Enumerable#filter_map... -
Enumerator
:: Lazy # grep(pattern) {|item| . . . } -> Enumerator :: Lazy (9200.0) -
Enumerable#grep と同じですが、配列ではなくEnumerator::Lazy を返します。
...rep と同じですが、配列ではなく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/).take(10).force
# => ["111", "222", "333", "444", "555", "666", "777", "888", "999", "1111"]
//}
@see Enumerable#grep......: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 (9200.0) -
Enumerable#grep_v と同じですが、配列ではなくEnumerator::Lazy を返します。
...rep_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/).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 # zip(*lists) -> Enumerator :: Lazy (9200.0) -
Enumerable#zip と同じですが、配列ではなくEnumerator::Lazy を返します。
...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).take(30).force.last(6)
# => [[25, "y"], [26, "z"], [27, "a"], [28, "b"], [29, "c"], [30, "d"]]
//}
@see Enumerable#zip...