Class: Gobstones::Lang::Commands::Mover
Instance Attribute Summary
#argument
Instance Method Summary
collapse
#equality_attributes, #initialize, #with_evaluated_argument_in
Methods inherited from Expression
#is_function_call?
#==, #equality_attributes
Instance Method Details
#evaluate(context) ⇒ Object
7
8
9
10
11
|
# File 'lib/gobstones/lang/commands/mover.rb', line 7
def evaluate(context)
with_evaluated_argument_in(context) do |result|
context.head.move result
end
end
|
#opposite ⇒ Object
17
18
19
|
# File 'lib/gobstones/lang/commands/mover.rb', line 17
def opposite
Mover.new(argument.opposite)
end
|
#undo(context) ⇒ Object
13
14
15
|
# File 'lib/gobstones/lang/commands/mover.rb', line 13
def undo(context)
opposite.evaluate context
end
|