Method: Weak::Map#has_value?
- Defined in:
- lib/weak/map.rb
#has_value?(value) ⇒ Bool Also known as: value?
Note:
Weak::Map does not test member equality with == or eql?.
Instead, it always checks strict object equality, so that, e.g.,
different String keys are not considered equal, even if they may
contain the same content.
Returns true if value is a value in self, false otherwise.
475 476 477 478 |
# File 'lib/weak/map.rb', line 475 def has_value?(value) id = value.__id__ each_value.any? { |v| v.__id__ == id } end |