Class: FFI::Enums
- Inherits:
-
Object
- Object
- FFI::Enums
- Defined in:
- lib/ffi/enum.rb
Overview
Instance Method Summary collapse
-
#<<(enum) ⇒ Object
Add an Enum to the collection.
-
#__map_symbol(symbol) ⇒ Object
A symbol.
-
#find(query) ⇒ Enum
Find a Enum in collection.
-
#initialize ⇒ Enums
constructor
A new instance of Enums.
Constructor Details
#initialize ⇒ Enums
Returns a new instance of Enums.
38 39 40 41 42 |
# File 'lib/ffi/enum.rb', line 38 def initialize @all_enums = Array.new @tagged_enums = Hash.new @symbol_map = Hash.new end |
Instance Method Details
#<<(enum) ⇒ Object
Add an FFI::Enum to the collection.
46 47 48 49 50 |
# File 'lib/ffi/enum.rb', line 46 def <<(enum) @all_enums << enum @tagged_enums[enum.tag] = enum unless enum.tag.nil? @symbol_map.merge!(enum.symbol_map) end |
#__map_symbol(symbol) ⇒ Object
Returns a symbol.
65 66 67 |
# File 'lib/ffi/enum.rb', line 65 def __map_symbol(symbol) @symbol_map[symbol] end |