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.

Parameters:

  • value (Object)

    a value to check

Returns:

  • (Bool)

    true if value is a value in self, false otherwise


474
475
476
477
# File 'lib/weak/map.rb', line 474

def has_value?(value)
  id = value.__id__
  each_value.any? { |v| v.__id__ == id }
end