### Home Classes Methods

### In Files

- lib/ffi/enum.rb

### Parent

Object

### Methods

- ::new
- #<<
- #__map_symbol
- #find

### Files

- Makefile
- ChangeLog
- LICENSE
- README
- compile
- configure
- depcomp
- stamp-vti
- install-sh
- libtool-version
- mdate-sh
- missing

### Class/Module Index

Quicksearch

- FFI
- FFI::AutoPointer
- FFI::AutoPointer::CallableReleaser
- FFI::AutoPointer::DefaultReleaser
- FFI::AutoPointer::Releaser
- FFI::ConstGenerator
- FFI::ConstGenerator::Constant
- FFI::Enum
- FFI::Enums
- FFI::Generator
- FFI::Generator::Task
- FFI::IO
- FFI::Library
- FFI::ManagedStruct
- FFI::NotFoundError
- FFI::Platform
- FFI::PlatformError
- FFI::Pointer
- FFI::StrPtrConverter
- FFI::Struct
- FFI::Struct::ManagedStructConverter
- FFI::StructGenerator
- FFI::StructGenerator::Field
- FFI::StructLayout
- FFI::StructLayout::Enum
- FFI::StructLayout::InnerStruct
- FFI::StructLayout::Mapped
- FFI::StructLayoutBuilder
- FFI::TypesGenerator
- FFI::Union
- FFI::VariadicInvoker

No matching classes.

# FFI::Enums

An instance of this class permits to manage {Enum}s. In fact, Enums is a collection of {Enum}s.

### Public Class Methods

new() click to toggle source

@return [nil]

    # File lib/ffi/enum.rb, line 28
    def initialize
      @all_enums = Array.new
      @tagged_enums = Hash.new
      @symbol_map = Hash.new
    end

### Public Instance Methods

<<(enum) click to toggle source

@param [Enum] enum Add an {Enum} to the collection.

    # File lib/ffi/enum.rb, line 36
    def <<(enum)
      @all_enums << enum
      @tagged_enums[enum.tag] = enum unless enum.tag.nil?
      @symbol_map.merge!(enum.symbol_map)
    end

__map_symbol(symbol) click to toggle source

@param symbol a symbol to find in merge symbol maps of all enums. @return a symbol

    # File lib/ffi/enum.rb, line 55
    def __map_symbol(symbol)
      @symbol_map[symbol]
    end

find(query) click to toggle source

@param query enum tag or part of an enum name @return [Enum] Find a {Enum} in collection.

    # File lib/ffi/enum.rb, line 45
    def find(query)
      if @tagged_enums.has_key?(query)
        @tagged_enums[query]
      else
        @all_enums.detect { |enum| enum.symbols.include?(query) }
      end
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.