Class: V8::Weak::Ref

Inherits:
Object
  • Object
show all
Defined in:
lib/v8/weak.rb

Instance Method Summary collapse

Constructor Details

#initialize(object) ⇒ Ref

Returns a new instance of Ref.



20
21
22
# File 'lib/v8/weak.rb', line 20

def initialize(object)
  @ref = ::WeakRef.new(object)
end

Instance Method Details

#objectObject



23
24
25
26
27
# File 'lib/v8/weak.rb', line 23

def object
  @ref.__getobj__
rescue ::WeakRef::RefError
  nil
end