diff options
| author | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-11-07 12:05:38 +0000 |
|---|---|---|
| committer | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-11-07 12:05:38 +0000 |
| commit | bf957e541305d1d51f8dc45600ae316bc86e9707 (patch) | |
| tree | 9b701a195ea778fd1323ef69976f6f4f4b5f4889 /lib | |
| parent | 0e7d135b9a98ba93cee9f49603b4a2a85366a55f (diff) | |
| download | ruby-bf957e541305d1d51f8dc45600ae316bc86e9707.tar.gz ruby-bf957e541305d1d51f8dc45600ae316bc86e9707.tar.xz ruby-bf957e541305d1d51f8dc45600ae316bc86e9707.zip | |
* lib/pp.rb (PP::ObjectMixin#pretty_print): use to_s regardless of
instance variables.
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@25683 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/pp.rb | 5 |
1 files changed, 2 insertions, 3 deletions
@@ -270,7 +270,7 @@ class PP < PrettyPrint module ObjectMixin # 1. specific pretty_print # 2. specific inspect - # 3. specific to_s if instance variable is empty + # 3. specific to_s # 4. generic pretty_print # A default pretty printing method for general objects. @@ -296,8 +296,7 @@ class PP < PrettyPrint q.text self.inspect elsif !inspect_method && self.respond_to?(:inspect) q.text self.inspect - elsif to_s_method && /\(Kernel\)#/ !~ to_s_method.inspect && - instance_variables.empty? + elsif to_s_method && /\(Kernel\)#/ !~ to_s_method.inspect q.text self.to_s elsif !to_s_method && self.respond_to?(:to_s) q.text self.to_s |
