2232件ヒット
[1-100件を表示]
(0.134秒)
クラス
-
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件
-
Numeric
# numerator -> Integer (24228.0) -
自身を Rational に変換した時の分子を返します。
...自身を Rational に変換した時の分子を返します。
@return 分子を返します。
@see Numeric#denominator、Integer#numerator、Float#numerator、Rational#numerator、Complex#numerator... -
Rational
# numerator -> Integer (24228.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... -
Complex
# numerator -> Complex (24216.0) -
分子を返します。
...分子を返します。
//emlist[例][ruby]{
Complex('1/2+2/3i').numerator # => (3+4i)
Complex(3).numerator # => (3+0i)
//}
@see Complex#denominator... -
Float
# numerator -> Integer (24216.0) -
自身を Rational に変換した時の分子を返します。
...自身を Rational に変換した時の分子を返します。
@return 分子を返します。
//emlist[例][ruby]{
2.0.numerator # => 2
0.5.numerator # => 1
//}
@see Float#denominator... -
Integer
# numerator -> Integer (24216.0) -
分子(常に自身)を返します。
...分子(常に自身)を返します。
@return 分子を返します。
//emlist[][ruby]{
10.numerator # => 10
-10.numerator # => -10
//}
@see Integer#denominator... -
Enumerable
# partition -> Enumerator (12303.0) -
各要素を、ブロックの条件を満たす要素と満たさない要素に分割します。 各要素に対してブロックを評価して、その値が真であった要素の配列と、 偽であった要素の配列の 2 つを配列に入れて返します。
...要素の配列と、
偽であった要素の配列の 2 つを配列に入れて返します。
ブロックを省略した場合は Enumerator を返します。
//emlist[例][ruby]{
[10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0].partition {|i| i % 3 == 0 }
#=> [[9, 6, 3, 0], [10, 8, 7, 5, 4, 2, 1]]
//}... -
Enumerator
:: Yielder # to _ proc -> Proc (12103.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 # filter {|item| . . . } -> Enumerator :: Lazy (9303.0) -
Enumerable#select と同じですが、配列ではなくEnumerator::Lazy を返します。
...le#select と同じですが、配列ではなくEnumerator::Lazy を返します。
@raise ArgumentError ブロックを指定しなかった場合に発生します。
//emlist[例][ruby]{
1.step.lazy.find_all { |i| i.even? }
# => #<Enumerator::Lazy: #<Enumerator::Lazy: #<Enumerator: 1:step>>:fi......nd_all>
1.step.lazy.select { |i| i.even? }.take(10).force
# => [2, 4, 6, 8, 10, 12, 14, 16, 18, 20]
//}
@see Enumerable#select... -
Enumerator
:: Lazy # filter _ map {|item| . . . } -> Enumerator :: Lazy (9303.0) -
Enumerable#filter_map と同じですが、配列ではなく Enumerator::Lazy を返します。
...lter_map と同じですが、配列ではなく Enumerator::Lazy を返します。
@raise ArgumentError ブロックを指定しなかった場合に発生します。
//emlist[例][ruby]{
1.step.lazy.filter_map { |n| n * 2 if n.even? }
# => #<Enumerator::Lazy: #<Enumerator::Lazy: (1.step)>:filt......er_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 # slice _ after(pattern) -> Enumerator :: Lazy (9303.0) -
Enumerable#slice_after と同じですが、配列ではなく Enumerator::Lazy を返します。
...le#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).forc......e
# => [[1, 2, 3], [4, 5, 6], [7, 8, 9], [10, 11, 12], [13, 14, 15]]
//}
@see Enumerable#slice_after... -
Enumerator
:: Lazy # to _ enum(method = :each , *args) -> Enumerator :: Lazy (9303.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......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 のおかげで、repeat の返り...