= private = protected
eql?(p1)
Returns true if array and other are the same object, or are both arrays with the same content.
/* * call-seq: * array.eql?(other) -> true or false * * Returns <code>true</code> if _array_ and _other_ are the same object, * or are both arrays with the same content. */ static VALUE rb_ary_eql(ary1, ary2) VALUE ary1, ary2; { if (ary1 == ary2) return Qtrue; if (TYPE(ary2) != T_ARRAY) return Qfalse; if (RARRAY(ary1)->len != RARRAY(ary2)->len) return Qfalse; if (rb_inspecting_p(ary1)) return Qfalse; return rb_protect_inspect(recursive_eql, ary1, 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