public Method

Comparable.==(p1)

obj == other     true or false

Compares two objects based on the receiver’s <=> method, returning true if it returns 0. Also returns true if obj and other are the same object.

Source Code

/*
*  call-seq:
*     obj == other    => true or false
*  
*  Compares two objects based on the receiver's <code><=></code>
*  method, returning true if it returns 0. Also returns true if
*  _obj_ and _other_ are the same object.
*/

static VALUE
cmp_equal(x, y)
   VALUE x, y;
{
   VALUE a[2];

   if (x == y) return Qtrue;

   a[0] = x; a[1] = y;
   return rb_rescue(cmp_eq, (VALUE)a, cmp_failed, 0);
}
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.