= private = protected
eql?(p1)
Returns true if self and other are the same object, or are both arrays with the same content.
static VALUE rb_ary_eql(VALUE ary1, VALUE ary2) { if (ary1 == ary2) return Qtrue; if (TYPE(ary2) != T_ARRAY) return Qfalse; if (RARRAY_LEN(ary1) != RARRAY_LEN(ary2)) return Qfalse; return rb_exec_recursive_paired(recursive_eql, ary1, ary2, ary2); }
Note that even if the arrays have the same content, the elements need to be ordered:
x = [1, 2, 3] y = [3, 2, 1] z = [1, 2, 3] x.eql?(y) #=> false x.eql?(z) #=> true x.eql?(y.sort) #=> true