public Method

Array.eql?(p1)

array.eql?(other)   true or false

Returns true if array and other are the same object, or are both arrays with the same content.

Source Code

/*
*  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;
{
   long i;

   if (ary1 == ary2) return Qtrue;
   if (TYPE(ary2) != T_ARRAY) return Qfalse;
   if (RARRAY(ary1)->len != RARRAY(ary2)->len) return Qfalse;
   for (i=0; i<RARRAY(ary1)->len; i++) {
       if (!rb_eql(rb_ary_elt(ary1, i), rb_ary_elt(ary2, i)))
           return Qfalse;
   }
   return Qtrue;
}
Comments

Have your say
Please use Textile formatting (click here for a cheat sheet). Use <code/> and <pre/> for code samples.
Click here to login with OpenID to to post comments.