==(p1)
public
Equality — Two arrays are equal if they contain the same number of
elements and if each element is equal to
(according to Object#==) the corresponding element in other_ary.
[ "a", "c" ] == [ "a", "c", 7 ]
[ "a", "c", 7 ] == [ "a", "c", 7 ]
[ "a", "c", 7 ] == [ "a", "d", "f" ]
Show source
static VALUE
rb_ary_equal(VALUE ary1, VALUE ary2)
{
if (ary1 == ary2) return Qtrue;
if (!RB_TYPE_P(ary2, T_ARRAY)) {
if (!rb_respond_to(ary2, idTo_ary)) {
return Qfalse;
}
return rb_equal(ary2, ary1);
}
if (RARRAY_LEN(ary1) != RARRAY_LEN(ary2)) return Qfalse;
if (RARRAY_CONST_PTR_TRANSIENT(ary1) == RARRAY_CONST_PTR_TRANSIENT(ary2)) return Qtrue;
return rb_exec_recursive_paired(recursive_equal, ary1, ary2, ary2);
}