Method: Exception#to_s
- Defined in:
- error.c
#to_s ⇒ String
Returns a string representation of self
:
x = RuntimeError.new('Boom')
x.to_s # => "Boom"
x = RuntimeError.new
x.to_s # => "RuntimeError"
1577 1578 1579 1580 1581 1582 1583 1584 |
# File 'error.c', line 1577
static VALUE
exc_to_s(VALUE exc)
{
VALUE mesg = rb_attr_get(exc, idMesg);
if (NIL_P(mesg)) return rb_class_name(CLASS_OF(exc));
return rb_String(mesg);
}
|