diff options
Diffstat (limited to 'object.c')
-rw-r--r-- | object.c | 12 |
1 files changed, 7 insertions, 5 deletions
@@ -676,17 +676,15 @@ nil_to_f(VALUE obj) /* * call-seq: - * nil.to_s => "" + * nil.to_s => "nil" * - * Always returns the empty string. - * - * nil.to_s #=> "" + * Always returns the string "nil". */ static VALUE nil_to_s(VALUE obj) { - return rb_str_new2(""); + return rb_str_new2("nil"); } /* @@ -2005,6 +2003,10 @@ rb_Integer(VALUE val) case T_STRING: return rb_str_to_inum(val, 0, Qtrue); + case T_NIL: + rb_raise(rb_eTypeError, "can't convert nil into Integer"); + break; + default: break; } |