るりまサーチ

最速Rubyリファレンスマニュアル検索!
11件ヒット [1-11件を表示] (0.385秒)
トップページ > ライブラリ:ビルトイン[x] > クエリ:_builtin[x] > クエリ:inspect[x] > クエリ:p[x] > クエリ:default_proc[x]

別のキーワード

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

クラス

検索結果

Hash#default_proc -> Proc | nil (32351.0)

ハッシュのデフォルト値を返す Proc オブジェクトを返します。 ハッシュがブロック形式のデフォルト値を持たない場合 nil を返します。

... Proc オブジェクトを返します。
ハッシュがブロック形式のデフォルト値を持たない場合 nil を返します。

//emlist[例][ruby]{
h = Hash.new {|hash, key| "The #{key} not exist in #{hash.inspect}"}
p
h.default #=> nil
p
block = h.default_proc #=> #<Pro...
...c:0x0x401a9ff4>
p
block.call({},:foo) #=> "The foo not exist in {}"

h = Hash.new("default")
p
h.default #=> "default"
p
h.default_proc #=> nil
//}

@see Hash#default...