Class FFI::ConstGenerator
In: lib/ffi/tools/const_generator.rb
Parent: Object

ConstGenerator turns C constants into ruby values.

Methods

[]   calculate   const   dump_constants   include   new   options   options=   to_ruby  

Classes and Modules

Class FFI::ConstGenerator::Constant

Attributes

constants  [R] 

Public Class methods

Creates a new constant generator that uses prefix as a name, and an options hash.

The only option is :required, which if set to true raises an error if a constant you have requested was not found.

When passed a block, calculate is automatically called at the end of the block, otherwise you must call it yourself.

Public Instance methods

Request the value for C constant name. format is a printf format string to print the value out, and cast is a C cast for the value. ruby_name allows you to give the constant an alternate ruby name for to_ruby. converter or converter_proc allow you to convert the value from a string to the appropriate type for to_ruby.

Outputs values for discovered constants. If the constant‘s value was not discovered it is not omitted.

[Validate]