method
has_value?
v2_2_9 -
Show latest stable
- Class:
Hash
has_value?(p1)public
Returns true if the given value is present for some key in hsh.
h = { "a" => 100, "b" => 200 } h.has_value?(100) #=> true h.has_value?(999) #=> false
1Note
Potentially slow operation
Remember that checking for a value is a potentially slow operation (all the elements might be iterated) as oposed to querying a key (e.g. with has_key?), which is supposed to be fast in a Hash.