Module: GirFFI::Builder
- Extended by:
- BuilderHelper
- Defined in:
- lib/gir_ffi/builder.rb
Overview
Builds modules and classes based on information found in the introspection repository. Call its build_module and build_class methods to create the modules and classes used in your program.
Class Method Summary collapse
-
.attach_ffi_function(lib, info) ⇒ Object
TODO: Move elsewhere, perhaps to FunctionBuilder.
- .build_by_gtype(gtype) ⇒ Object
- .build_class(info) ⇒ Object
- .build_module(namespace, version = nil) ⇒ Object
Methods included from BuilderHelper
get_or_define_class, get_or_define_module, optionally_define_constant
Class Method Details
.attach_ffi_function(lib, info) ⇒ Object
TODO: Move elsewhere, perhaps to FunctionBuilder.
35 36 37 38 39 40 |
# File 'lib/gir_ffi/builder.rb', line 35 def self.attach_ffi_function(lib, info) sym = info.symbol return if lib.method_defined? sym lib.attach_function sym, info.argument_ffi_types, info.return_ffi_type end |
.build_by_gtype(gtype) ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/gir_ffi/builder.rb', line 18 def self.build_by_gtype(gtype) info = GObjectIntrospection::IRepository.default.find_by_gtype gtype info ||= case GObject.type_fundamental gtype when GObject::TYPE_BOXED UnintrospectableBoxedInfo.new gtype when GObject::TYPE_OBJECT UnintrospectableTypeInfo.new gtype end build_class info end |
.build_class(info) ⇒ Object
14 15 16 |
# File 'lib/gir_ffi/builder.rb', line 14 def self.build_class(info) Builders::TypeBuilder.build(info) end |
.build_module(namespace, version = nil) ⇒ Object
30 31 32 |
# File 'lib/gir_ffi/builder.rb', line 30 def self.build_module(namespace, version = nil) Builders::ModuleBuilder.new(namespace, version).generate end |