clear()
public
Removes all key-value pairs from hsh.
h = { "a" => 100, "b" => 200 }
h.clear
Show source
/*
* call-seq:
* hsh.clear -> hsh
*
* Removes all key-value pairs from <i>hsh</i>.
*
* h = { "a" => 100, "b" => 200 }
* h.clear
*
*/
static VALUE
rb_hash_clear(hash)
VALUE hash;
{
rb_hash_modify(hash);
if (RHASH(hash)->tbl->num_entries > 0) {
rb_hash_foreach(hash, clear_i, 0);
}
return hash;
}