instance method
Hash#default=
(V arg0) -> V
default = value → object
hash.c
View on GitHub ↗
VALUE
rb_hash_set_default(VALUE hash, VALUE ifnone)
{
rb_hash_modify_check(hash);
SET_DEFAULT(hash, ifnone);
return ifnone;
}
Sets the default value to value; returns value:
Example
h = {} h.default # => nil h.default = false # => false h.default # => false
See Hash Default.
See also
#default
#default_proc
#compare_by_identity?
#default_proc=
also in
4.1 · 3.4 · 3.3 · 3.2 · 3.1 · 3.0