Class: V8::Weak::WeakValueMap

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

Instance Method Summary collapse

Constructor Details

#initializeWeakValueMap

Returns a new instance of WeakValueMap.



28
29
30
# File 'lib/v8/weak.rb', line 28

def initialize
  @values = {}
end

Instance Method Details

#[](key) ⇒ Object



32
33
34
35
36
# File 'lib/v8/weak.rb', line 32

def [](key)
  if ref = @values[key]
    ref.object
  end
end

#[]=(key, value) ⇒ Object



38
39
40
# File 'lib/v8/weak.rb', line 38

def []=(key, value)
  @values[key] = V8::Weak::Ref.new(value)
end