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) ⇒ Object



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

def method_missing(method, ...)
  result = setup_method method.to_s
  return super unless result

  send(method, ...)
end

Instance Method Details

#const_missing(classname) ⇒ Object



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

def const_missing(classname)
  load_class(classname)
end

#gir_ffi_builderObject



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

def gir_ffi_builder
  self::GIR_FFI_BUILDER
end

#load_class(classname) ⇒ Object



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

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

#respond_to_missing?(method) ⇒ Boolean

Returns:



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

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