= private = protected
eql?(p1)
Returns true if self and other are the same object, or are both arrays with the same content (according to Object#eql?).
static VALUE rb_ary_eql(VALUE ary1, VALUE ary2) { if (ary1 == ary2) return Qtrue; if (!RB_TYPE_P(ary2, T_ARRAY)) return Qfalse; if (RARRAY_LEN(ary1) != RARRAY_LEN(ary2)) return Qfalse; if (RARRAY_CONST_PTR(ary1) == RARRAY_CONST_PTR(ary2)) return Qtrue; 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