Method: Hash#default_proc
- Defined in:
- hash.c
#default_proc ⇒ Proc?
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
2268 2269 2270 2271 2272 2273 2274 2275 |
# File 'hash.c', line 2268 static VALUE rb_hash_default_proc(VALUE hash) { if (FL_TEST(hash, RHASH_PROC_DEFAULT)) { return RHASH_IFNONE(hash); } return Qnil; } |