Weak Reference class that allows a referenced object to be garbage-collected.
A WeakRef
may be used exactly like the object it references.
Usage:
foo = Object.new p foo.to_s foo = WeakRef.new(foo) p foo.to_s GC.start p foo.to_sConstants
def initialize(orig) case orig when true, false, nil @delegate_sd_obj = orig else @@__map[self] = orig end super end
Creates a weak reference to orig
def weakref_alive? @@__map.key?(self) or defined?(@delegate_sd_obj) end
Returns true if the referenced object is still alive.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.3