summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2005-11-30 04:44:12 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2005-11-30 04:44:12 +0000
commit1ebb90495827893026fe41294db238fab6e3a86c (patch)
treefa44f18ba25612030c5aaec49837d0efe427f53f /lib
parent96aa0c2a8fc63976d1f28af6a0681a749b8b2bde (diff)
ChangeLog lib/pp.rb
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@9632 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib')
-rw-r--r--lib/pp.rb10
1 files changed, 9 insertions, 1 deletions
diff --git a/lib/pp.rb b/lib/pp.rb
index dcd293ca7a..934ad6bf67 100644
--- a/lib/pp.rb
+++ b/lib/pp.rb
@@ -150,6 +150,14 @@ class PP < PrettyPrint
group(1, '#<' + obj.class.name, '>', &block)
end
+ if 0x100000000.class == Bignum
+ # 32bit
+ PointerMask = 0xffffffff
+ else
+ # 64bit
+ PointerMask = 0xffffffffffffffff
+ end
+
case Object.new.inspect
when /\A\#<Object:0x([0-9a-f]+)>\z/
PointerFormat = "%0#{$1.length}x"
@@ -158,7 +166,7 @@ class PP < PrettyPrint
end
def object_address_group(obj, &block)
- id = PointerFormat % (obj.__id__ * 2)
+ id = PointerFormat % (obj.__id__ * 2 & PointerMask)
id.sub!(/\Af(?=[[:xdigit:]]{2}+\z)/, '') if id.sub!(/\A\.\./, '')
group(1, "\#<#{obj.class}:0x#{id}", '>', &block)
end