るりまサーチ

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

別のキーワード

  1. socket ip_block_source
  2. socket mcast_block_source
  3. openssl block_size
  4. psych block
  5. digest block_length

ライブラリ

クラス

モジュール

キーワード

検索結果

Kernel.#block_given? -> bool (24213.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.
//}...

static VALUE rb_f_block_given_p(void) (6116.0)

block_given? の実体。 現在評価中の (Ruby で実装された) メソッドに対して ブロックが与えられていたら真。

...
block_given?
の実体。
現在評価中の (Ruby で実装された) メソッドに対して
ブロックが与えられていたら真。...

Kernel.#iterator? -> bool (6013.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.
//}...

Enumerator::Lazy#enum_for(method = :each, *args) {|*args| block} -> Enumerator::Lazy (106.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 (106.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}...

絞り込み条件を変える