Module: GirFFI::ModuleBase

Includes:
MethodSetup
Defined in:
lib/gir_ffi/module_base.rb

Overview

Base module for modules representing GLib namespaces.

Instance Method Summary collapse

Methods included from MethodSetup

#setup_method, #setup_method!

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

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



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

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



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

def const_missing(classname)
  load_class(classname)
end

#gir_ffi_builderObject



28
29
30
# File 'lib/gir_ffi/module_base.rb', line 28

def gir_ffi_builder
  self::GIR_FFI_BUILDER
end

#load_class(classname) ⇒ Object



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

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

#respond_to_missing?(method) ⇒ Boolean

Returns:



16
17
18
# File 'lib/gir_ffi/module_base.rb', line 16

def respond_to_missing?(method, *)
  gir_ffi_builder.method_available? method
end