Preview Ruby 4.1 is a preview. It can change before the final release. Switch to Ruby 4.0 →
instance method
Hash#compare_by_identity?
() -> bool
compare_by_identity? → true or false
hash.c
View on GitHub ↗
VALUE
rb_hash_compare_by_id_p(VALUE hash)
{
return RBOOL(RHASH_IDENTHASH_P(hash));
}
Returns whether compare_by_identity has been called:
Example
h = {} h.compare_by_identity? # => false h.compare_by_identity h.compare_by_identity? # => true
Related: compare_by_identity; see also Methods for Comparing.