/usr/lib/ruby/vendor_ruby/gir_ffi/object_store.rb is in ruby-gir-ffi 0.9.0-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | module GirFFI
# Helper class for storing objects for later retrieval. Used to store user
# data arguments.
class ObjectStore
def initialize
@store = {}
end
def store(obj)
# FIXME: Don't use object_id!
key = obj.object_id
@store[key] = obj
FFI::Pointer.new(key)
end
def fetch(ptr)
return if ptr.null?
key = ptr.address
if @store.key? key
@store[key]
else
ptr
end
end
end
end
|