class GirFFI::ArgHelper::ObjectStore
Helper class for storing objects for later retrieval. Used to store user data arguments.
Public Class Methods
new()
click to toggle source
# File lib/gir_ffi/arg_helper.rb, line 12 def initialize @store = {} end
Public Instance Methods
fetch(ptr)
click to toggle source
# File lib/gir_ffi/arg_helper.rb, line 20 def fetch(ptr) return if ptr.null? key = ptr.address if @store.key? key @store[key] else ptr end end
store(ptr, obj)
click to toggle source
# File lib/gir_ffi/arg_helper.rb, line 16 def store(ptr, obj) @store[ptr.address] = obj end