Class: DTRToRust::Instruction::Handler
- Inherits:
-
Object
- Object
- DTRToRust::Instruction::Handler
show all
- Defined in:
- lib/instruction/handler.rb
Overview
This class is responsible for generating Rust code for the AddAndAssign instruction.
Class Method Summary
collapse
Instance Method Summary
collapse
Constructor Details
#initialize(instruction) ⇒ Handler
Returns a new instance of Handler.
7
8
9
|
# File 'lib/instruction/handler.rb', line 7
def initialize(instruction)
@instruction = instruction
end
|
Class Method Details
.handle(instruction) ⇒ Object
11
12
13
|
# File 'lib/instruction/handler.rb', line 11
def self.handle(instruction)
new(instruction).handle
end
|
Instance Method Details
19
20
21
|
# File 'lib/instruction/handler.rb', line 19
def form_rust_string(instruction_string, scope)
"#{spacing(scope)}#{instruction_string}"
end
|
#spacing(scope) ⇒ Object
15
16
17
|
# File 'lib/instruction/handler.rb', line 15
def spacing(scope)
' ' * scope
end
|