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
  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)
end

#gir_ffi_builderObject



18
19
20
# File 'lib/gir_ffi/module_base.rb', line 18

def gir_ffi_builder
  self::GIR_FFI_BUILDER
end

#load_class(classname) ⇒ Object



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

def load_class(classname)
  gir_ffi_builder.build_namespaced_class classname.to_s
end

#setup_method(name) ⇒ Object



22
23
24
# File 'lib/gir_ffi/module_base.rb', line 22

def setup_method(name)
  gir_ffi_builder.setup_method name
end