From fd7dc23d281f38a71fa7f9c32812cd468c4b1788 Mon Sep 17 00:00:00 2001 From: eregon Date: Wed, 15 Aug 2012 11:50:01 +0000 Subject: Kernel#inspect: improve consistency and do not call #to_s. * object.c (rb_obj_inspect): Kernel#inspect: 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. * NEWS: Add note about the change. * bignum.c, io.c, numeric.c, object.c, proc.c, vm.c (Init_*): Adapt internal structures (by aliasing #inspect to #to_s) so they don't rely on the removed behavior (#inspect calling overridden #to_s). * test/ruby/test_object.rb (test_inspect): add tests for Kernel#inspect. * lib/pp.rb (class PP): do not call #to_s anymore, as #inspect no more does (mame). * test/test_pp.rb (class PPInspectTest): remove related assertion (mame). [ruby-core:43238][Feature #6130] * test/drb/drbtest.rb (DRbCore#teardown, DRbAry#teardown): adapt DRb tests with the new change (shirosaki). [ruby-core:47182][Bug #6866] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36709 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- io.c | 1 + 1 file changed, 1 insertion(+) (limited to 'io.c') diff --git a/io.c b/io.c index 52eb49574b..b1a38cc707 100644 --- a/io.c +++ b/io.c @@ -11505,6 +11505,7 @@ Init_IO(void) rb_define_method(rb_cARGF, "initialize", argf_initialize, -2); rb_define_method(rb_cARGF, "initialize_copy", argf_initialize_copy, 1); rb_define_method(rb_cARGF, "to_s", argf_to_s, 0); + rb_define_alias(rb_cARGF, "inspect", "to_s"); rb_define_method(rb_cARGF, "argv", argf_argv, 0); rb_define_method(rb_cARGF, "fileno", argf_fileno, 0); -- cgit v1.2.3