has_key?(p1)
public
Returns true if the given key is present in
hsh.
h = { "a" => 100, "b" => 200 }
h.has_key?("a")
h.has_key?("z")
Show source
VALUE
rb_hash_has_key(VALUE hash, VALUE key)
{
if (!RHASH(hash)->ntbl)
return Qfalse;
if (st_lookup(RHASH(hash)->ntbl, key, 0)) {
return Qtrue;
}
return Qfalse;
}