1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

gc.c: ObjectSpace::WeakMap#key?

* gc.c (wmap_each_i): add ObjectSpace::WeakMap#key? method.

* lib/weakref.rb (WeakRef#weakref_alive): use above method.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43351 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2013-10-18 06:59:12 +00:00
parent b443d83a77
commit e12799fd31
2 changed files with 11 additions and 1 deletions

View file

@ -101,7 +101,7 @@ class WeakRef < Delegator
# Returns true if the referenced object is still alive.
def weakref_alive?
!!(@@__map[self] or defined?(@delegate_sd_obj))
@@__map.key?(self) or defined?(@delegate_sd_obj)
end
end