Class: Furnace::AVM2::Binary::ChoiceDefinition
- Inherits:
-
Object
- Object
- Furnace::AVM2::Binary::ChoiceDefinition
- Defined in:
- lib/furnace-avm2/binary/choice_definition.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize ⇒ ChoiceDefinition
constructor
A new instance of ChoiceDefinition.
- #to_a ⇒ Object
- #variant(value, type, sub_options = {}) ⇒ Object
Constructor Details
#initialize ⇒ ChoiceDefinition
Returns a new instance of ChoiceDefinition.
3 4 5 |
# File 'lib/furnace-avm2/binary/choice_definition.rb', line 3 def initialize @data = [] end |
Class Method Details
.parse(block) ⇒ Object
7 8 9 10 11 |
# File 'lib/furnace-avm2/binary/choice_definition.rb', line 7 def self.parse(block) instance = new instance.instance_exec(&block) instance.to_a end |
Instance Method Details
#to_a ⇒ Object
17 18 19 |
# File 'lib/furnace-avm2/binary/choice_definition.rb', line 17 def to_a @data end |
#variant(value, type, sub_options = {}) ⇒ Object
13 14 15 |
# File 'lib/furnace-avm2/binary/choice_definition.rb', line 13 def variant(value, type, ={}) @data << [ value, type, ] end |