static public Method

SystemCallError.===(p1)

system_call_error === other   true or false

Return true if the receiver is a generic SystemCallError, or if the error numbers self and other are the same.

Source Code

/*
* call-seq:
*   system_call_error === other  => true or false
*
* Return +true+ if the receiver is a generic +SystemCallError+, or
* if the error numbers _self_ and _other_ are the same.
*/


static VALUE
syserr_eqq(self, exc)
   VALUE self, exc;
{
   VALUE num, e;

   if (!rb_obj_is_kind_of(exc, rb_eSystemCallError)) return Qfalse;
   if (self == rb_eSystemCallError) return Qtrue;

   num = rb_attr_get(exc, rb_intern("errno"));
   if (NIL_P(num)) {
       VALUE klass = CLASS_OF(exc);

       while (TYPE(klass) == T_ICLASS || FL_TEST(klass, FL_SINGLETON)) {
           klass = (VALUE)RCLASS(klass)->super;
       }
       num = rb_const_get(klass, rb_intern("Errno"));
   }
   e = rb_const_get(self, rb_intern("Errno"));
   if (FIXNUM_P(num) ? num == e : rb_equal(num, e))
       return Qtrue;
   return Qfalse;
}
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.