class Gobstones::Lang::Commands::Poner

Public Instance Methods

evaluate(context) click to toggle source
# File lib/gobstones/lang/commands/poner.rb, line 9
def evaluate(context)
  with_evaluated_argument_in(context) do |result|
    context.head.put result
  end
rescue RuntimeError => e
  raise Runner::GobstonesTypeError, e.message
end
opposite() click to toggle source
# File lib/gobstones/lang/commands/poner.rb, line 25
def opposite
  Sacar.new(argument)
end
undo(context) click to toggle source
# File lib/gobstones/lang/commands/poner.rb, line 17
def undo(context)
  # TODO maybe the command should use the original context
  # instead of this one (when it was executed)
  with_evaluated_argument_in(context) do |result|
    context.head.take_out result
  end
end