diff options
author | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 1998-06-08 01:40:08 +0000 |
---|---|---|
committer | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 1998-06-08 01:40:08 +0000 |
commit | 7acc47fe82fd49cc5ac5d63ec67a2be92ad56d3c (patch) | |
tree | 5b5183b1d17756d2fb304957e82aea15dba52a8d /lib/weakref.rb | |
parent | 5196e8609ba576021305710610b071d31777e798 (diff) |
regex.c
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/v1_1r@235 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/weakref.rb')
-rw-r--r-- | lib/weakref.rb | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/lib/weakref.rb b/lib/weakref.rb index 6ef4b422c8..539bb9336c 100644 --- a/lib/weakref.rb +++ b/lib/weakref.rb @@ -41,14 +41,9 @@ class WeakRef<Delegator def __getobj__ unless ID_MAP[@__id] - $@ = caller(1) - $! = RefError.new("Illegal Reference - probably recycled") - raise + raise RefError, "Illegal Reference - probably recycled", caller(2) end ObjectSpace._id2ref(@__id) -# ObjectSpace.each_object do |obj| -# return obj if obj.id == @__id -# end end def weakref_alive? @@ -66,9 +61,9 @@ end if __FILE__ == $0 foo = Object.new - p foo.hash + p foo.hash # original's hash value foo = WeakRef.new(foo) - p foo.hash + p foo.hash # should be same hash value ObjectSpace.garbage_collect - p foo.hash + p foo.hash # should raise exception (recycled) end |