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:
parent
b443d83a77
commit
e12799fd31
2 changed files with 11 additions and 1 deletions
|
@ -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
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue