diff options
author | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2005-11-28 11:26:39 +0000 |
---|---|---|
committer | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2005-11-28 11:26:39 +0000 |
commit | 2387667a1ca29cfccfa33b1cebe1d6b39cd36da3 (patch) | |
tree | b7fed36f201a153623b5ade2a0d6fc20ca9876cc | |
parent | fb4b89b2b6849966cb05837a97f2e4b404d341e4 (diff) | |
download | ruby-2387667a1ca29cfccfa33b1cebe1d6b39cd36da3.tar.gz ruby-2387667a1ca29cfccfa33b1cebe1d6b39cd36da3.tar.xz ruby-2387667a1ca29cfccfa33b1cebe1d6b39cd36da3.zip |
* lib/pp.rb (PP::PPMethods#object_address_group): adjust address format.
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@9628 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ChangeLog | 4 | ||||
-rw-r--r-- | lib/pp.rb | 9 |
2 files changed, 12 insertions, 1 deletions
@@ -1,3 +1,7 @@ +Mon Nov 28 20:24:22 2005 Tanaka Akira <akr@m17n.org> + + * lib/pp.rb (PP::PPMethods#object_address_group): adjust address format. + Mon Nov 28 18:55:22 2005 NAKAMURA Usaku <usa@ruby-lang.org> * ext/socket/socket.c (init_inetsock_internal): remove setting @@ -150,8 +150,15 @@ class PP < PrettyPrint group(1, '#<' + obj.class.name, '>', &block) end + case Object.new.inspect + when /\A\#<Object:0x([0-9a-f]+)>\z/ + PointerFormat = "%0#{$1.length}x" + else + PointerFormat = "%x" + end + def object_address_group(obj, &block) - id = "%x" % (obj.__id__ * 2) + id = PointerFormat % (obj.__id__ * 2) id.sub!(/\Af(?=[[:xdigit:]]{2}+\z)/, '') if id.sub!(/\A\.\./, '') group(1, "\#<#{obj.class}:0x#{id}", '>', &block) end |