959件ヒット
[1-100件を表示]
(0.164秒)
ライブラリ
クラス
- Array (55)
- Bignum (6)
- Enumerator (66)
-
Enumerator
:: Chain (12) -
Enumerator
:: Lazy (109) -
Enumerator
:: Yielder (11) - Fixnum (6)
- Float (11)
- Hash (16)
- Integer (33)
- Matrix (35)
- Numeric (55)
- Object (44)
-
OpenSSL
:: SSL :: SSLContext (11) - Pathname (11)
- Range (11)
- Rational (4)
- Vector (45)
-
Win32
:: Registry (11) -
Zlib
:: GzipReader (44)
モジュール
- Enumerable (341)
- Kernel (22)
キーワード
- % (11)
- ** (21)
- bsearch (22)
- chain (6)
- chunk (11)
- collect (50)
- collect! (23)
- collect2 (11)
-
collect
_ concat (33) -
convertible
_ int (22) - div (11)
- divmod (22)
- each (78)
-
each
_ byte (11) -
each
_ line (22) -
each
_ with _ index (22) -
each
_ with _ object (22) - entries (11)
-
enum
_ for (44) -
filter
_ map (15) -
flat
_ map (33) - force (11)
-
grep
_ v (22) - info (11)
- lazy (11)
- lineno= (11)
- map (50)
- map! (23)
-
max
_ by (44) - modulo (11)
- pow (11)
- remainder (11)
-
session
_ cache _ stats (11) - sum (22)
-
to
_ a (11) -
to
_ enum (44) -
to
_ h (17) -
to
_ set (22) -
transform
_ values (8) -
transform
_ values! (8) -
with
_ index (16) -
with
_ object (11) - yield (11)
- zip (44)
検索結果
先頭5件
-
Bignum
# *(other) -> Fixnum | Bignum | Float (24501.0) -
算術演算子。積を計算します。
...算術演算子。積を計算します。
@param other 二項演算の右側の引数(対象)
@return 計算結果... -
Fixnum
# *(other) -> Fixnum | Bignum | Float (24501.0) -
算術演算子。積を計算します。
...算術演算子。積を計算します。
@param other 二項演算の右側の引数(対象)
@return 計算結果... -
Integer
# *(other) -> Numeric (21307.0) -
算術演算子。積を計算します。
...算術演算子。積を計算します。
@param other 二項演算の右側の引数(対象)
@return 計算結果
//emlist[][ruby]{
2 * 3 # => 6
//}... -
Enumerator
:: Lazy # enum _ for(method = :each , *args) {|*args| block} -> Enumerator :: Lazy (18665.0) -
Object#to_enum と同じですが、Enumerator::Lazy を返します。
...Object#to_enum と同じですが、Enumerator::Lazy を返します。
to_enum は「ブロック付きで呼ぶとループを実行し、ブロックを省略した場合は
Enumerator を返す」ようなメソッドを定義するときによく使われます。
このときに lazy 性が......_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 block_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 のおかげ... -
Enumerator
:: Lazy # to _ enum(method = :each , *args) {|*args| block} -> Enumerator :: Lazy (18665.0) -
Object#to_enum と同じですが、Enumerator::Lazy を返します。
...Object#to_enum と同じですが、Enumerator::Lazy を返します。
to_enum は「ブロック付きで呼ぶとループを実行し、ブロックを省略した場合は
Enumerator を返す」ようなメソッドを定義するときによく使われます。
このときに lazy 性が......_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 block_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 のおかげ... -
Enumerator
:: Lazy # enum _ for(method = :each , *args) -> Enumerator :: Lazy (18565.0) -
Object#to_enum と同じですが、Enumerator::Lazy を返します。
...Object#to_enum と同じですが、Enumerator::Lazy を返します。
to_enum は「ブロック付きで呼ぶとループを実行し、ブロックを省略した場合は
Enumerator を返す」ようなメソッドを定義するときによく使われます。
このときに lazy 性が......_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 block_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 のおかげ... -
Enumerator
:: Lazy # to _ enum(method = :each , *args) -> Enumerator :: Lazy (18565.0) -
Object#to_enum と同じですが、Enumerator::Lazy を返します。
...Object#to_enum と同じですが、Enumerator::Lazy を返します。
to_enum は「ブロック付きで呼ぶとループを実行し、ブロックを省略した場合は
Enumerator を返す」ようなメソッドを定義するときによく使われます。
このときに lazy 性が......_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 block_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 のおかげ... -
Object
# enum _ for(method = :each , *args) {|*args| . . . } -> Enumerator (12681.0) -
Enumerator.new(self, method, *args) を返します。
...Enumerator.new(self, method, *args) を返します。
ブロックを指定した場合は Enumerator#size がブロックの評価結果を返
します。ブロックパラメータは引数 args です。
@param method メソッド名の文字列かシンボルです。
@param args 呼び出......"xyz"
enum = str.enum_for(:each_byte)
p(a = enum.map{|b| '%02x' % b }) #=> ["78", "79", "7a"]
# protects an array from being modified
a = [1, 2, 3]
p(a.to_enum) #=> #<Enumerator: [1, 2, 3]:each>
//}
//emlist[例(ブロックを指定する場合)][ruby]{
module Enumerable
def repeat(n)
rai......ntError, "#{n} is negative!" if n < 0
unless block_given?
# __method__ はここでは :repeat
return to_enum(__method__, n) do
# size メソッドが nil でなければ size * n を返す。
sz = size
sz * n if sz
end
end
each do |*val|
n... -
Object
# to _ enum(method = :each , *args) {|*args| . . . } -> Enumerator (12681.0) -
Enumerator.new(self, method, *args) を返します。
...Enumerator.new(self, method, *args) を返します。
ブロックを指定した場合は Enumerator#size がブロックの評価結果を返
します。ブロックパラメータは引数 args です。
@param method メソッド名の文字列かシンボルです。
@param args 呼び出......"xyz"
enum = str.enum_for(:each_byte)
p(a = enum.map{|b| '%02x' % b }) #=> ["78", "79", "7a"]
# protects an array from being modified
a = [1, 2, 3]
p(a.to_enum) #=> #<Enumerator: [1, 2, 3]:each>
//}
//emlist[例(ブロックを指定する場合)][ruby]{
module Enumerable
def repeat(n)
rai......ntError, "#{n} is negative!" if n < 0
unless block_given?
# __method__ はここでは :repeat
return to_enum(__method__, n) do
# size メソッドが nil でなければ size * n を返す。
sz = size
sz * n if sz
end
end
each do |*val|
n... -
Object
# enum _ for(method = :each , *args) -> Enumerator (12581.0) -
Enumerator.new(self, method, *args) を返します。
...Enumerator.new(self, method, *args) を返します。
ブロックを指定した場合は Enumerator#size がブロックの評価結果を返
します。ブロックパラメータは引数 args です。
@param method メソッド名の文字列かシンボルです。
@param args 呼び出......"xyz"
enum = str.enum_for(:each_byte)
p(a = enum.map{|b| '%02x' % b }) #=> ["78", "79", "7a"]
# protects an array from being modified
a = [1, 2, 3]
p(a.to_enum) #=> #<Enumerator: [1, 2, 3]:each>
//}
//emlist[例(ブロックを指定する場合)][ruby]{
module Enumerable
def repeat(n)
rai......ntError, "#{n} is negative!" if n < 0
unless block_given?
# __method__ はここでは :repeat
return to_enum(__method__, n) do
# size メソッドが nil でなければ size * n を返す。
sz = size
sz * n if sz
end
end
each do |*val|
n... -
Object
# to _ enum(method = :each , *args) -> Enumerator (12581.0) -
Enumerator.new(self, method, *args) を返します。
...Enumerator.new(self, method, *args) を返します。
ブロックを指定した場合は Enumerator#size がブロックの評価結果を返
します。ブロックパラメータは引数 args です。
@param method メソッド名の文字列かシンボルです。
@param args 呼び出......"xyz"
enum = str.enum_for(:each_byte)
p(a = enum.map{|b| '%02x' % b }) #=> ["78", "79", "7a"]
# protects an array from being modified
a = [1, 2, 3]
p(a.to_enum) #=> #<Enumerator: [1, 2, 3]:each>
//}
//emlist[例(ブロックを指定する場合)][ruby]{
module Enumerable
def repeat(n)
rai......ntError, "#{n} is negative!" if n < 0
unless block_given?
# __method__ はここでは :repeat
return to_enum(__method__, n) do
# size メソッドが nil でなければ size * n を返す。
sz = size
sz * n if sz
end
end
each do |*val|
n...