default_proc=

hsh.default_proc = proc_obj or nil
Instance Public methods

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

h.default_proc = proc do |hash, key|
  hash[key] = key + key
end
h[2]       #=> 4
h["cat"]   #=> "catcat"
doc_ruby_on_rails
2015-04-11 22:17:35
Comments
Leave a Comment

Please login to continue.