Preview Ruby 4.1 is a preview. It can change before the final release. Switch to Ruby 4.0 →
instance method
Set#compare_by_identity?
() -> bool
compare_by_identity? → true or false
set.c
View on GitHub ↗
static VALUE
set_i_compare_by_identity_p(VALUE set)
{
return RBOOL(RSET_COMPARE_BY_IDENTITY(set));
}
Returns whether self compares elements by object identity (rather than by content):
Example
set = Set[] set.compare_by_identity? # => false set.compare_by_identity set.compare_by_identity? # => true
Related: compare_by_identity; see also Methods for Querying.