Object
@!visibility private
This is a pure ruby implementation of a weak reference. It is much more efficient than the WeakRef implementation bundled in MRI 1.8 and 1.9 subclass Delegator which is very heavy to instantiate and utilizes a because it does not fair amount of memory under Ruby 1.8.
@!visibility private
This implementation of a weak reference simply wraps the standard WeakRef implementation that comes with the Ruby standard library.
# File lib/concurrent/atomic/thread_local_var/weak_key_map.rb, line 38 def initialize(obj) @referenced_object_id = obj.__id__ @ref = ::WeakRef.new(obj) end
# File lib/concurrent/atomic/thread_local_var/weak_key_map.rb, line 43 def object @ref.__getobj__ rescue => e # Jruby implementation uses RefError while MRI uses WeakRef::RefError if (defined?(RefError) && e.is_a?(RefError)) || (defined?(::WeakRef::RefError) && e.is_a?(::WeakRef::RefError)) nil else raise e end end
Generated with the Darkfish Rdoc Generator 2.