member?(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
/*
* call-seq:
* hsh.has_key?(key) => true or false
* hsh.include?(key) => true or false
* hsh.key?(key) => true or false
* hsh.member?(key) => true or false
*
* Returns <code>true</code> if the given key is present in <i>hsh</i>.
*
* h = { "a" => 100, "b" => 200 }
* h.has_key?("a") #=> true
* h.has_key?("z") #=> false
*
*/
static VALUE
rb_hash_has_key(hash, key)
VALUE hash;
VALUE key;
{
if (st_lookup(RHASH(hash)->tbl, key, 0)) {
return Qtrue;
}
return Qfalse;
}