Ruby 4.0 リファレンスマニュアル

instance method Set#compare_by_identity?

compare_by_identity? -> boolRuby 3.0 から[permalink][rdoc][edit]

集合が要素の一致判定をオブジェクトの同一性を用いて行っているならば真を返します。

s1 = Set["a", "b"]
p s1.compare_by_identity? # => false

s1.compare_by_identity

p s1.compare_by_identity? # => true

[SEE_ALSO] Set#compare_by_identity, Hash#compare_by_identity?