Class: Furnace::AVM2::Binary::ChoiceDefinition

Inherits:
Object
  • Object
show all
Defined in:
lib/furnace-avm2/binary/choice_definition.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeChoiceDefinition

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_aObject



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, sub_options={})
  @data << [ value, type, sub_options ]
end