lib/gobstones/lang/commands/poner_cmd.rb in gobstones-0.0.1.1 vs lib/gobstones/lang/commands/poner_cmd.rb in gobstones-0.0.2
- old
+ new
@@ -7,25 +7,29 @@
module Lang
class Poner < OneArgExpression
def evaluate(context)
- context.head.put arg.evaluate(context)
+ with_evaluated_argument_in(context) do |result|
+ context.head.put result
+ end
rescue RuntimeError => e
raise Gobstones::Runner::GobstonesTypeError, e.message
end
def undo(context)
# TODO maybe the command should use the original context
# instead of this one (when it was executed)
- context.head.take_out arg.evaluate(context)
+ with_evaluated_argument_in(context) do |result|
+ context.head.take_out result
+ end
end
def opposite
- Sacar.new arg
+ Sacar.new argument
end
end
end
-end
\ No newline at end of file
+end