Class: DTRToRust::InstructionHandler
- Inherits:
-
Object
- Object
- DTRToRust::InstructionHandler
- Defined in:
- lib/instruction_handler.rb
Overview
This class is responsible for generating Rust code for a single instruction.
Instance Method Summary collapse
- #generate_rust ⇒ Object
-
#initialize(instruction) ⇒ InstructionHandler
constructor
A new instance of InstructionHandler.
Constructor Details
#initialize(instruction) ⇒ InstructionHandler
Returns a new instance of InstructionHandler.
6 7 8 |
# File 'lib/instruction_handler.rb', line 6 def initialize(instruction) @instruction = instruction end |
Instance Method Details
#generate_rust ⇒ Object
10 11 12 13 14 15 16 17 18 19 |
# File 'lib/instruction_handler.rb', line 10 def generate_rust case @instruction[:instruction] when 'AddSymbols' handle_add_symbols when 'Return' handle_return else raise "Unknown instruction type: #{@instruction[:instruction]}" end end |