Method: Kernel#Hash
- Defined in:
- object.c
#Hash(arg) ⇒ Hash
Converts arg to a Hash by calling arg.to_hash
. Returns an empty Hash when arg is nil
or []
.
Hash([]) #=> {}
Hash(nil) #=> {}
Hash(key: :value) #=> {:key => :value}
Hash([1, 2, 3]) #=> TypeError
4010 4011 4012 4013 4014 |
# File 'object.c', line 4010
static VALUE
rb_f_hash(VALUE obj, VALUE arg)
{
return rb_Hash(arg);
}
|