Module: GirFFI::ModuleBase

Defined in:
lib/gir_ffi/module_base.rb

Overview

Base module for modules representing GLib namespaces.

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method, *arguments, &block) ⇒ Object



4
5
6
7
8
# File 'lib/gir_ffi/module_base.rb', line 4

def method_missing method, *arguments, &block
  result = setup_method method.to_s
  return super unless result
  self.send method, *arguments, &block
end

Instance Method Details

#const_missing(classname) ⇒ Object



10
11
12
# File 'lib/gir_ffi/module_base.rb', line 10

def const_missing classname
  load_class(classname) || super
end

#gir_ffi_builderObject



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

def gir_ffi_builder
  self.const_get :GIR_FFI_BUILDER
end

#setup_class(classname) ⇒ Object Also known as: load_class



14
15
16
# File 'lib/gir_ffi/module_base.rb', line 14

def setup_class classname
  gir_ffi_builder.build_namespaced_class classname.to_s
end

#setup_method(name) ⇒ Object



24
25
26
# File 'lib/gir_ffi/module_base.rb', line 24

def setup_method name
  gir_ffi_builder.setup_method name
end