るりまサーチ

最速Rubyリファレンスマニュアル検索!
110件ヒット [1-100件を表示] (0.261秒)

別のキーワード

  1. _builtin new
  2. _builtin inspect
  3. _builtin []
  4. _builtin to_s
  5. _builtin each

クラス

モジュール

キーワード

検索結果

<< 1 2 > >>

Kernel.#block_given? -> bool (26115.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.
ch...

Kernel.#iterator? -> bool (11015.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.
ch...

Enumerator::Lazy#enum_for(method = :each, *args) -> Enumerator::Lazy (8008.0)

Object#to_enum と同じですが、Enumerator::Lazy を返します。

...素を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}...

Enumerator::Lazy#enum_for(method = :each, *args) {|*args| block} -> Enumerator::Lazy (8008.0)

Object#to_enum と同じですが、Enumerator::Lazy を返します。

...素を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}...

Enumerator::Lazy#to_enum(method = :each, *args) -> Enumerator::Lazy (8008.0)

Object#to_enum と同じですが、Enumerator::Lazy を返します。

...素を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}...

絞り込み条件を変える

Enumerator::Lazy#to_enum(method = :each, *args) {|*args| block} -> Enumerator::Lazy (8008.0)

Object#to_enum と同じですが、Enumerator::Lazy を返します。

...素を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}...

Object#enum_for(method = :each, *args) -> Enumerator (8008.0)

Enumerator.new(self, method, *args) を返します。

...(ブロックを指定する場合)][ruby]{
module Enumerable
def repeat(n)
raise ArgumentError, "#{n} is negative!" if n < 0
unless block_given?
# __method__ はここでは :repeat
return to_enum(__method__, n) do
# size メソッドが nil でなければ size * n...

Object#enum_for(method = :each, *args) {|*args| ... } -> Enumerator (8008.0)

Enumerator.new(self, method, *args) を返します。

...(ブロックを指定する場合)][ruby]{
module Enumerable
def repeat(n)
raise ArgumentError, "#{n} is negative!" if n < 0
unless block_given?
# __method__ はここでは :repeat
return to_enum(__method__, n) do
# size メソッドが nil でなければ size * n...

Object#to_enum(method = :each, *args) -> Enumerator (8008.0)

Enumerator.new(self, method, *args) を返します。

...(ブロックを指定する場合)][ruby]{
module Enumerable
def repeat(n)
raise ArgumentError, "#{n} is negative!" if n < 0
unless block_given?
# __method__ はここでは :repeat
return to_enum(__method__, n) do
# size メソッドが nil でなければ size * n...

Object#to_enum(method = :each, *args) {|*args| ... } -> Enumerator (8008.0)

Enumerator.new(self, method, *args) を返します。

...(ブロックを指定する場合)][ruby]{
module Enumerable
def repeat(n)
raise ArgumentError, "#{n} is negative!" if n < 0
unless block_given?
# __method__ はここでは :repeat
return to_enum(__method__, n) do
# size メソッドが nil でなければ size * n...

絞り込み条件を変える

<< 1 2 > >>