Class: GirFFI::Builders::ModuleBuilder
- Inherits:
-
Object
- Object
- GirFFI::Builders::ModuleBuilder
- Includes:
- GirFFI::BuilderHelper
- Defined in:
- lib/gir_ffi/builders/module_builder.rb
Overview
Builds a module based on information found in the introspection repository.
Instance Method Summary collapse
- #build_namespaced_class(classname) ⇒ Object
- #generate ⇒ Object
-
#initialize(namespace, version = nil) ⇒ ModuleBuilder
constructor
A new instance of ModuleBuilder.
- #setup_method(method) ⇒ Object
Methods included from GirFFI::BuilderHelper
#get_or_define_class, #get_or_define_module, #optionally_define_constant
Constructor Details
#initialize(namespace, version = nil) ⇒ ModuleBuilder
Returns a new instance of ModuleBuilder.
13 14 15 16 17 18 |
# File 'lib/gir_ffi/builders/module_builder.rb', line 13 def initialize namespace, version = nil @namespace = namespace @version = version # FIXME: Pass safe namespace as an argument @safe_namespace = @namespace.gsub(/^./, &:upcase) end |
Instance Method Details
#build_namespaced_class(classname) ⇒ Object
34 35 36 37 38 39 40 41 |
# File 'lib/gir_ffi/builders/module_builder.rb', line 34 def build_namespaced_class classname info = gir.find_by_name @namespace, classname.to_s unless info raise NameError, "Class #{classname} not found in namespace #{@namespace}" end Builder.build_class info end |
#generate ⇒ Object
20 21 22 |
# File 'lib/gir_ffi/builders/module_builder.rb', line 20 def generate modul end |
#setup_method(method) ⇒ Object
24 25 26 27 28 29 30 31 32 |
# File 'lib/gir_ffi/builders/module_builder.rb', line 24 def setup_method method go = function_introspection_data method.to_s return false unless go Builder.attach_ffi_function lib, go modul.class_eval FunctionBuilder.new(go).generate true end |