diff options
author | eregon <eregon@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-08-14 10:20:44 +0000 |
---|---|---|
committer | eregon <eregon@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-08-14 10:20:44 +0000 |
commit | 795c29dcda01fa81a3ccebee4433adabe6778d76 (patch) | |
tree | f2793f0ffc75a3292d7276ef087ca20cfd0d6e02 /proc.c | |
parent | f42a7c09513b5f73e21e6fae881f3bc2f760b9af (diff) | |
download | ruby-795c29dcda01fa81a3ccebee4433adabe6778d76.tar.gz |
Kernel#inspect: improve consistency and do not call #to_s.
A class can now benefit from the nice default #inspect even if it
defines #to_s. Also, there is no more unexpected change in #inspect
result. Internal structures have been adapted so they don't rely
on the removed behavior (#inspect calling overridden #to_s).
* object.c (rb_obj_inspect): Kernel#inspect: do not call #to_s.
* test/ruby/test_object.rb (test_inspect): add tests for Kernel#inspect.
* bignum.c, io.c, numeric.c, object.c, proc.c, vm.c (Init_*):
alias #inspect to #to_s where it was expected.
[ruby-core:43238][Feature #6130]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36699 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'proc.c')
-rw-r--r-- | proc.c | 1 |
1 files changed, 1 insertions, 0 deletions
@@ -2217,6 +2217,7 @@ Init_Proc(void) rb_define_method(rb_cProc, "eql?", proc_eq, 1); rb_define_method(rb_cProc, "hash", proc_hash, 0); rb_define_method(rb_cProc, "to_s", proc_to_s, 0); + rb_define_alias(rb_cProc, "inspect", "to_s"); rb_define_method(rb_cProc, "lambda?", rb_proc_lambda_p, 0); rb_define_method(rb_cProc, "binding", proc_binding, 0); rb_define_method(rb_cProc, "curry", proc_curry, -1); |