2733件ヒット
[1-100件を表示]
(0.202秒)
ライブラリ
クラス
-
ARGF
. class (119) - Array (296)
- Complex (22)
- Date (33)
- Dir (17)
- Enumerator (171)
-
Enumerator
:: ArithmeticSequence (84) -
Enumerator
:: Chain (30) -
Enumerator
:: Lazy (378) -
Enumerator
:: Yielder (27) - Float (22)
-
Gem
:: SourceIndex (11) - Hash (152)
- IO (141)
- Integer (55)
- Matrix (78)
- Numeric (73)
- Object (57)
- OpenStruct (11)
- Pathname (57)
- Prime (11)
-
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)
- TSort (30)
キーワード
- % (12)
- + (6)
- << (11)
- == (6)
- 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)
- compact (3)
- cycle (22)
-
delete
_ if (33) - denominator (55)
- descend (11)
- detect (11)
- downto (22)
- drop (11)
-
drop
_ while (33) - each (266)
- each2 (11)
-
each
_ byte (55) -
each
_ char (44) -
each
_ child (28) -
each
_ codepoint (44) -
each
_ cons (11) -
each
_ entry (13) -
each
_ grapheme _ cluster (7) -
each
_ index (22) -
each
_ key (11) -
each
_ line (99) -
each
_ pair (33) -
each
_ slice (11) -
each
_ strongly _ connected _ component (10) -
each
_ strongly _ connected _ component _ from (10) -
each
_ value (11) -
each
_ with _ index (33) -
each
_ with _ object (11) - eager (5)
- end (6)
-
enum
_ for (44) -
exclude
_ end? (6) - feed (11)
- filter (30)
- filter! (12)
-
filter
_ map (10) - find (22)
-
find
_ all (22) -
find
_ index (33) - first (12)
-
flat
_ map (22) - force (11)
- grep (11)
-
grep
_ v (9) -
group
_ by (11) - gsub (11)
- gsub! (11)
- hash (6)
- index (22)
- inspect (12)
-
keep
_ if (22) - last (12)
- lazy (22)
- lines (49)
- map (55)
- map! (23)
-
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 (22) - 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 (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 (10) - uniq (16)
- upto (22)
-
with
_ index (43) -
with
_ object (33) - yield (11)
-
yield
_ self (7) - zip (22)
検索結果
先頭5件
-
Numeric
# numerator -> Integer (33326.0) -
自身を Rational に変換した時の分子を返します。
...自身を Rational に変換した時の分子を返します。
@return 分子を返します。
@see Numeric#denominator、Integer#numerator、Float#numerator、Rational#numerator、Complex#numerator... -
Rational
# numerator -> Integer (33326.0) -
分子を返します。
...分子を返します。
@return 分子を返します。
//emlist[例][ruby]{
Rational(7).numerator # => 7
Rational(7, 1).numerator # => 7
Rational(9, -4).numerator # => -9
Rational(-2, -10).numerator # => 1
//}
@see Rational#denominator... -
Float
# numerator -> Integer (33314.0) -
自身を Rational に変換した時の分子を返します。
...自身を Rational に変換した時の分子を返します。
@return 分子を返します。
//emlist[例][ruby]{
2.0.numerator # => 2
0.5.numerator # => 1
//}
@see Float#denominator... -
Complex
# numerator -> Complex (30314.0) -
分子を返します。
...分子を返します。
//emlist[例][ruby]{
Complex('1/2+2/3i').numerator # => (3+4i)
Complex(3).numerator # => (3+0i)
//}
@see Complex#denominator... -
Integer
# numerator -> Integer (30314.0) -
分子(常に自身)を返します。
...分子(常に自身)を返します。
@return 分子を返します。
//emlist[][ruby]{
10.numerator # => 10
-10.numerator # => -10
//}
@see Integer#denominator... -
Enumerator
:: Lazy # collect _ concat {|item| . . . } -> Enumerator :: Lazy (18419.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}].lazy.flat_map {|i| i}.force
#=> [{:a=>1}, {:......b=>2}]
//}
@raise ArgumentError ブロックを指定しなかった場合に発生します。
@see Enumerable#flat_map... -
Rational
# denominator -> Integer (18207.0) -
分母を返します。常に正の整数を返します。
...分母を返します。常に正の整数を返します。
@return 分母を返します。
//emlist[例][ruby]{
Rational(7).denominator # => 1
Rational(7, 1).denominator # => 1
Rational(9, -4).denominator # => 4
Rational(-2, -10).denominator # => 5
//}
@see Rational#numerator... -
Array
# repeated _ combination(n) -> Enumerator (15603.0) -
サイズ n の重複組み合わせをすべて生成し、それを引数としてブロックを実行 します。
...サイズ n の重複組み合わせをすべて生成し、それを引数としてブロックを実行
します。
得られる組み合わせの順序は保証されません。ブロックなしで呼び出されると、
組み合わせを生成する Enumerator オブジェクトを返し......ます。
@param n 生成される配列のサイズを整数で指定します。
整数以外のオブジェクトを指定した場合は to_int メソッドによる暗
黙の型変換を試みます。
@raise TypeError 引数に整数以外の(暗黙の型変換が行えな......{
a = [1, 2, 3]
a.repeated_combination(1).to_a #=> [[1], [2], [3]]
a.repeated_combination(2).to_a #=> [[1,1],[1,2],[1,3],[2,2],[2,3],[3,3]]
a.repeated_combination(3).to_a #=> [[1,1,1],[1,1,2],[1,1,3],[1,2,2],[1,2,3],
# [1,3,3],[2,2,2],[2,2,3],[2,3,3],[3,3,3]]
a.... -
Array
# repeated _ permutation(n) -> Enumerator (15591.0) -
サイズ n の重複順列をすべて生成し,それを引数としてブロックを実行します。
...サイズ n の重複順列をすべて生成し,それを引数としてブロックを実行します。
得られる順列の順序は保証されません。ブロックなしで呼び出されると, 順列
を生成する Enumerator オブジェクトを返します。
@param n 生成......to_int メソッドによる暗
黙の型変換を試みます。
@raise TypeError 引数に整数以外の(暗黙の型変換が行えない)オブジェクトを
指定した場合に発生します。
//emlist[例][ruby]{
a = [1, 2]
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 permutation of length 0
//}
ブロッ... -
Enumerator
:: Lazy # enum _ for(method = :each , *args) -> Enumerator :: Lazy (15455.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)
raise ArgumentError if n < 0
if......ock_given?
each do |*val|
n.times { yield *val }
end
else
to_enum(:repeat, n)
end
end
end
r = 1..10
p r.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 の...