class GirFFI::BoxedBase

Base class for generated classes representing boxed types.

Public Class Methods

copy(val) click to toggle source
# File lib/gir_ffi/boxed_base.rb, line 12
def self.copy(val)
  ptr = GObject.boxed_copy(gtype, val)
  wrap(ptr)
end
make_finalizer(struct) click to toggle source
# File lib/gir_ffi/boxed_base.rb, line 8
def self.make_finalizer(struct)
  proc { finalize(struct) }
end

Protected Class Methods

finalize(struct) click to toggle source
# File lib/gir_ffi/boxed_base.rb, line 20
def finalize(struct)
  struct.owned? or return

  struct.owned = nil
  GObject.boxed_free gtype, struct.to_ptr
end

Private Instance Methods

make_finalizer() click to toggle source
# File lib/gir_ffi/boxed_base.rb, line 35
def make_finalizer
  ObjectSpace.define_finalizer self, self.class.make_finalizer(struct)
end
store_pointer(*) click to toggle source
Calls superclass method
# File lib/gir_ffi/boxed_base.rb, line 30
def store_pointer(*)
  super
  make_finalizer
end