Class: GirFFI::Builders::StructBuilder

Inherits:
RegisteredTypeBuilder show all
Includes:
StructLike
Defined in:
lib/gir_ffi/builders/struct_builder.rb

Overview

Implements the creation of a class representing a Struct.

Instance Attribute Summary

Attributes inherited from GirFFI::BaseTypeBuilder

#info

Instance Method Summary collapse

Methods included from StructLike

#setup_class, #setup_field_accessors

Methods included from WithLayout

#layout_specification

Methods inherited from RegisteredTypeBuilder

#setup_instance_method, #setup_method, #target_gtype

Methods inherited from GirFFI::BaseTypeBuilder

#build_class, #instantiate_class

Methods included from GirFFI::BuilderHelper

#get_or_define_class, #get_or_define_module, #optionally_define_constant

Constructor Details

#initialize(info, superclass: nil) ⇒ StructBuilder

Returns a new instance of StructBuilder.



13
14
15
16
# File 'lib/gir_ffi/builders/struct_builder.rb', line 13

def initialize(info, superclass: nil)
  @superclass = superclass
  super info
end

Instance Method Details

#superclassObject



18
19
20
21
22
23
24
25
26
# File 'lib/gir_ffi/builders/struct_builder.rb', line 18

def superclass
  @superclass ||= if info.gtype_struct?
                    gtype_struct_parent
                  elsif GObject.type_fundamental(info.gtype) == GObject::TYPE_BOXED
                    BoxedBase
                  else
                    StructBase
                  end
end