===(p1)
public
Return true if the receiver is a generic SystemCallError, or if the error
numbers self and other are the same.
Show source
/*
* 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;
ID en = rb_intern("errno");
if (!rb_obj_is_kind_of(exc, rb_eSystemCallError)) {
if (!rb_respond_to(exc, en)) return Qfalse;
}
else if (self == rb_eSystemCallError) return Qtrue;
num = rb_attr_get(exc, en);
if (NIL_P(num)) {
num = rb_funcall(exc, en, 0, 0);
}
e = rb_const_get(self, rb_intern("Errno"));
if (FIXNUM_P(num) ? num == e : rb_equal(num, e))
return Qtrue;
return Qfalse;
}