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.



31
32
33
# File 'lib/v8/weak.rb', line 31

def initialize
  @values = {}
end

Instance Method Details

#[](key) ⇒ Object



35
36
37
38
39
# File 'lib/v8/weak.rb', line 35

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

#[]=(key, value) ⇒ Object



41
42
43
# File 'lib/v8/weak.rb', line 41

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