るりまサーチ

最速Rubyリファレンスマニュアル検索!
12件ヒット [1-12件を表示] (0.036秒)
トップページ > クエリ:ruby[x] > 種類:インスタンスメソッド[x] > クエリ:inspect[x] > クラス:Hash[x] > クエリ:default_proc[x]

別のキーワード

  1. _builtin inspect
  2. csv inspect
  3. inspect _builtin
  4. matrix inspect
  5. rake inspect

ライブラリ

検索結果

Hash#default_proc -> Proc | nil (18127.0)

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

...][ruby]{
h = Hash.new {|hash, key| "The #{key} not exist in #{hash.inspect}"}
p h.default #=> nil
p block = h.default_proc #=> #<Proc: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...