Method: Hash#size
- Defined in:
- hash.c
#length ⇒ Fixnum #size ⇒ Fixnum
Returns the number of key-value pairs in the hash.
h = { "d" => 100, "a" => 200, "v" => 300, "e" => 400 }
h.length #=> 4
h.delete("a") #=> 200
h.length #=> 3
1563 1564 1565 1566 1567 |
# File 'hash.c', line 1563
VALUE
rb_hash_size(VALUE hash)
{
return INT2FIX(RHASH_SIZE(hash));
}
|