Class: FFI::Generator::Enum
Instance Attribute Summary
Attributes inherited from Node
Instance Method Summary collapse
-
#initialize(params = { }) ⇒ Enum
constructor
A new instance of Enum.
- #to_s ⇒ Object
Methods inherited from Node
Constructor Details
#initialize(params = { }) ⇒ Enum
Returns a new instance of Enum.
4 5 6 7 |
# File 'lib/generator/enum.rb', line 4 def initialize(params = { }) super eval_items end |
Instance Method Details
#to_s ⇒ Object
8 9 10 11 12 |
# File 'lib/generator/enum.rb', line 8 def to_s @items.sort { |i1, i2| i1[1] <=> i2[1] }.inject("") do |result, item| result << assignment_str(item[0], item[1]) << "\n" end end |