Class: GirFFI::ArgHelper::ObjectStore

Inherits:
Object
  • Object
show all
Defined in:
lib/gir_ffi/arg_helper.rb

Instance Method Summary collapse

Constructor Details

#initializeObjectStore

Returns a new instance of ObjectStore.



8
9
10
# File 'lib/gir_ffi/arg_helper.rb', line 8

def initialize
  @store = {}
end

Instance Method Details

#fetch(ptr) ⇒ Object



16
17
18
19
20
21
22
23
24
# File 'lib/gir_ffi/arg_helper.rb', line 16

def fetch(ptr)
  return if ptr.null?
  key = ptr.address
  if @store.has_key? key
    @store[key]
  else
    ptr
  end
end

#store(ptr, obj) ⇒ Object



12
13
14
# File 'lib/gir_ffi/arg_helper.rb', line 12

def store(ptr, obj)
  @store[ptr.address] = obj
end