Skip to content

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

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.

See also #compare_by_identity #delete #collect! #delete? also in 4.0 · 3.4 · 3.3 · 3.2 · 3.1 · 3.0