Class: GirFFI::Builder::Type::UserDefined
- Inherits:
-
Object
- Object
- Base
- RegisteredType
- Object
- GirFFI::Builder::Type::UserDefined
- Defined in:
- lib/gir_ffi/builder/type/user_defined.rb
Overview
Implements the creation of GObject subclasses from Ruby.
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
-
#initialize(info) ⇒ UserDefined
constructor
A new instance of UserDefined.
- #instantiate_class ⇒ Object
- #setup_class ⇒ Object
Methods inherited from Object
Methods included from WithMethods
#has_instance_method, #setup_instance_method, #setup_method
Methods inherited from Base
Methods included from GirFFI::BuilderHelper
#const_defined_for, #optionally_define_constant
Constructor Details
#initialize(info) ⇒ UserDefined
Returns a new instance of UserDefined.
9 10 11 |
# File 'lib/gir_ffi/builder/type/user_defined.rb', line 9 def initialize info @info = info end |
Instance Method Details
#instantiate_class ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/gir_ffi/builder/type/user_defined.rb', line 13 def instantiate_class @klass = @info.described_class parent_type = @klass.get_gtype @parent = gir.find_by_gtype(parent_type) query_result = GObject.type_query parent_type type_info = GObject::TypeInfo.new type_info.class_size = query_result.class_size type_info.instance_size = query_result.instance_size properties.each do type_info.instance_size += FFI.type_size(:int32) end @gtype = GObject.type_register_static(parent_type, @klass.name, type_info, 0) @structklass = get_or_define_class @klass, :Struct, layout_superclass setup_class unless already_set_up CACHE[@gtype] = @klass end |
#setup_class ⇒ Object
35 36 37 38 39 40 41 42 43 44 |
# File 'lib/gir_ffi/builder/type/user_defined.rb', line 35 def setup_class setup_layout setup_constants #stub_methods setup_gtype_getter setup_property_accessors #setup_vfunc_invokers #setup_interfaces setup_constructor end |