Class: PyCall::WrapperObjectCache::Key

Inherits:
Object
  • Object
show all
Defined in:
lib/pycall/wrapper_object_cache.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(address) ⇒ Key

Returns a new instance of Key.



31
32
33
# File 'lib/pycall/wrapper_object_cache.rb', line 31

def initialize(address)
  @address = address
end

Instance Attribute Details

#addressObject (readonly)

Returns the value of attribute address.



35
36
37
# File 'lib/pycall/wrapper_object_cache.rb', line 35

def address
  @address
end

Class Method Details

.[](address) ⇒ Object



25
26
27
28
29
# File 'lib/pycall/wrapper_object_cache.rb', line 25

def self.[](address)
  # An instance of Key created here is parmanently cached in @address_key_map.
  # This behavior is intentional.
  @address_key_map[address] ||= new(address)
end

Instance Method Details

#==(other) ⇒ Object



37
38
39
40
41
42
43
44
# File 'lib/pycall/wrapper_object_cache.rb', line 37

def ==(other)
  case other
  when Key
    self.address == other.address
  else
    super
  end
end