class FFI::ConstGenerator

def const(name, format = nil, cast = '', ruby_name = nil, converter = nil,

Other tags:
    Yieldparam: value - constant value

Overloads:
  • const(name, format=nil, cast='', ruby_name=nil) { |value| ... }
  • const(name, format=nil, cast='', ruby_name=nil, converter=nil)

Parameters:
  • converter (#call) -- convert the value from a string to the appropriate
  • ruby_name () -- alternate ruby name for {#to_ruby}
  • cast (String) -- a C cast for the value
  • format (String) -- a printf format string to print the value out
  • name (#to_s) -- C constant name
def const(name, format = nil, cast = '', ruby_name = nil, converter = nil,
          &converter_proc)
  format ||= '%d'
  cast ||= ''
  if converter_proc and converter then
    raise ArgumentError, "Supply only converter or converter block"
  end
  converter = converter_proc if converter.nil?
  const = Constant.new name, format, cast, ruby_name, converter
  @constants[name.to_s] = const
  return const
end