default_proc

hsh.default_proc â anObject
Instance Public methods

If Hash::new was invoked with a block, return that block, otherwise return nil.

h = Hash.new {|h,k| h[k] = k*k }   #=> {}
p = h.default_proc                 #=> #<Proc:0x401b3d08@-:1>
a = []                             #=> []
p.call(a, 2)
a                                  #=> [nil, nil, 4]
doc_ruby_on_rails
2015-04-11 22:14:00
Comments
Leave a Comment

Please login to continue.