110件ヒット
[1-100件を表示]
(0.269秒)
種類
- インスタンスメソッド (88)
- モジュール関数 (22)
ライブラリ
- ビルトイン (110)
クラス
-
Enumerator
:: Lazy (44) - Object (44)
モジュール
- Kernel (22)
検索結果
先頭5件
-
Kernel
. # block _ given? -> bool (26125.0) -
メソッドにブロックが与えられていれば真を返します。
...ートするとはいえないので)推奨されていないの
で block_given? を使ってください。
//emlist[例][ruby]{
def check
if block_given?
puts "Block is given."
else
puts "Block isn't given."
end
end
check{} #=> Block is given.
check #=> Block isn't given.
//}... -
Kernel
. # iterator? -> bool (11025.0) -
メソッドにブロックが与えられていれば真を返します。
...ートするとはいえないので)推奨されていないの
で block_given? を使ってください。
//emlist[例][ruby]{
def check
if block_given?
puts "Block is given."
else
puts "Block isn't given."
end
end
check{} #=> Block is given.
check #=> Block isn't given.
//}... -
Object
# enum _ for(method = :each , *args) -> Enumerator (8036.0) -
Enumerator.new(self, method, *args) を返します。
...nless 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.times { yield *val }
end
end
end
%i... -
Object
# enum _ for(method = :each , *args) {|*args| . . . } -> Enumerator (8036.0) -
Enumerator.new(self, method, *args) を返します。
...nless 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.times { yield *val }
end
end
end
%i... -
Object
# to _ enum(method = :each , *args) -> Enumerator (8036.0) -
Enumerator.new(self, method, *args) を返します。
...nless 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.times { yield *val }
end
end
end
%i... -
Object
# to _ enum(method = :each , *args) {|*args| . . . } -> Enumerator (8036.0) -
Enumerator.new(self, method, *args) を返します。
...nless 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.times { yield *val }
end
end
end
%i... -
Enumerator
:: Lazy # enum _ for(method = :each , *args) -> Enumerator :: Lazy (8030.0) -
Object#to_enum と同じですが、Enumerator::Lazy を返します。
...].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::IN... -
Enumerator
:: Lazy # enum _ for(method = :each , *args) {|*args| block} -> Enumerator :: Lazy (8030.0) -
Object#to_enum と同じですが、Enumerator::Lazy を返します。
...].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::IN... -
Enumerator
:: Lazy # to _ enum(method = :each , *args) -> Enumerator :: Lazy (8030.0) -
Object#to_enum と同じですが、Enumerator::Lazy を返します。
...].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::IN... -
Enumerator
:: Lazy # to _ enum(method = :each , *args) {|*args| block} -> Enumerator :: Lazy (8030.0) -
Object#to_enum と同じですが、Enumerator::Lazy を返します。
...].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::IN...