size()
public
Returns the number of key-value pairs in the hash.
h = { "d" => 100, "a" => 200, "v" => 300, "e" => 400 }
h.size
h.delete("a")
h.size
h.length
Hash#length is an alias for Hash#size.
Show source
VALUE
rb_hash_size(VALUE hash)
{
return INT2FIX(RHASH_SIZE(hash));
}