るりまサーチ

最速Rubyリファレンスマニュアル検索!
110件ヒット [1-100件を表示] (0.313秒)
トップページ > クエリ:_builtin[x] > クエリ:end[x] > クエリ:block_given?[x]

別のキーワード

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

ライブラリ

クラス

モジュール

キーワード

検索結果

<< 1 2 > >>

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...

絞り込み条件を変える

<< 1 2 > >>