method

default_proc=

v1_9_3_392 - Show latest stable - Class: Hash
default_proc=(p1)
public

Sets the default proc to be executed on each key lookup.

h.default_proc = proc do |hash, key|
  hash[key] = key + key
end
h[2]       #=> 4
h["cat"]   #=> "catcat"