clear()
public
Removes all key-value pairs from hsh.
h = { "a" => 100, "b" => 200 }
h.clear
Show source
VALUE
rb_hash_clear(VALUE hash)
{
rb_hash_modify_check(hash);
if (!RHASH(hash)->ntbl)
return hash;
if (RHASH(hash)->ntbl->num_entries > 0) {
if (RHASH_ITER_LEV(hash) > 0)
rb_hash_foreach(hash, clear_i, 0);
else
st_clear(RHASH(hash)->ntbl);
}
return hash;
}