Class: GirFFI::BoxedBase

Inherits:
StructBase show all
Defined in:
lib/gir_ffi/boxed_base.rb

Overview

Base class for generated classes representing boxed types.

Constant Summary

Constants inherited from ClassBase

ClassBase::GIR_FFI_BUILDER

Instance Attribute Summary

Attributes inherited from ClassBase

#struct

Class Method Summary collapse

Instance Method Summary collapse

Methods included from StructLikeBase

included

Methods inherited from ClassBase

#==, direct_wrap, from, #setup_and_call, setup_and_call, setup_instance_method, setup_method, to_ffi_type, try_in_ancestors, wrap

Methods included from RegisteredTypeBase

#gtype

Methods included from TypeBase

#gir_ffi_builder, #gir_info

Constructor Details

#initializeBoxedBase

Returns a new instance of BoxedBase.



7
8
9
# File 'lib/gir_ffi/boxed_base.rb', line 7

def initialize
  store_pointer(nil)
end

Class Method Details

.copy(val) ⇒ Object



20
21
22
23
# File 'lib/gir_ffi/boxed_base.rb', line 20

def self.copy(val)
  ptr = GObject.boxed_copy(gtype, val)
  wrap(ptr)
end

.make_finalizer(struct) ⇒ Object



11
12
13
14
15
16
17
18
# File 'lib/gir_ffi/boxed_base.rb', line 11

def self.make_finalizer(struct)
  proc do
    if struct.owned?
      struct.owned = nil
      GObject.boxed_free gtype, struct.to_ptr
    end
  end
end