module GirFFI::BuilderHelper
Set of helper methods used in the builders.
Public Instance Methods
get_or_define_class(namespace, name, parent)
click to toggle source
# File lib/gir_ffi/builder_helper.rb, line 12 def get_or_define_class(namespace, name, parent) optionally_define_constant(namespace, name) { Class.new parent } end
get_or_define_module(parent, name)
click to toggle source
# File lib/gir_ffi/builder_helper.rb, line 16 def get_or_define_module(parent, name) optionally_define_constant(parent, name) { Module.new } end
optionally_define_constant(parent, name) { || ... }
click to toggle source
# File lib/gir_ffi/builder_helper.rb, line 4 def optionally_define_constant(parent, name) if parent.const_defined? name, false parent.const_get name else parent.const_set name, yield end end