module GirFFI::BuilderHelper

Public Instance Methods

const_defined_for(parent, name) click to toggle source
# File lib/gir_ffi/builder_helper.rb, line 3
def const_defined_for parent, name
  if RUBY_VERSION < "1.9"
    parent.const_defined? name
  else
    parent.const_defined? name, false
  end
end
optionally_define_constant(parent, name) { || ... } click to toggle source
# File lib/gir_ffi/builder_helper.rb, line 11
def optionally_define_constant parent, name
  if const_defined_for parent, name
    parent.const_get name
  else
    parent.const_set name, yield
  end
end