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.



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

def initialize(address)
  @address = address
end

Instance Attribute Details

#addressObject (readonly)

Returns the value of attribute address.



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

def address
  @address
end

Class Method Details

.[](address) ⇒ Object



20
21
22
23
24
# File 'lib/pycall/wrapper_object_cache.rb', line 20

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



32
33
34
35
36
37
38
39
# File 'lib/pycall/wrapper_object_cache.rb', line 32

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