Ruby Newbie homepage Ruby Newbie homepage

How to use

Quick guide

Official content
Returns the default proc for self (see Default Values):
h = {}
h.default_proc # => nil
h.default_proc = proc {|hash, key| "Default value for #{key}" }
h.default_proc.class # => Proc
 
               static VALUE
rb_hash_default_proc(VALUE hash)
{
    if (FL_TEST(hash, RHASH_PROC_DEFAULT)) {
        return RHASH_IFNONE(hash);
    }
    return Qnil;
}
            

Was this page useful?