Preview Ruby 4.1 is a preview. It can change before the final release. Switch to Ruby 4.0 →
instance method
Comparable#==
(untyped other) -> bool
obj == other → true or false
compar.c
View on GitHub ↗
static VALUE
cmp_equal(VALUE x, VALUE y)
{
VALUE c;
if (x == y) return Qtrue;
c = rb_exec_recursive_paired_outer(cmp_eq_recursive, x, y, y);
if (NIL_P(c)) return Qfalse;
return RBOOL(rb_cmpint(c, x, y) == 0);
}
Compares two objects based on the receiver’s <=> method, returning true if it returns 0. Also returns true if obj and other are the same object.