Class: Gobstones::Lang::Commands::Sacar
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
9
10
11
12
13
14
15
|
# File 'lib/gobstones/lang/commands/sacar.rb', line 9
def evaluate(context)
with_evaluated_argument_in(context) do |result|
context.head.take_out result
end
rescue RuntimeError => e
raise Runner::GobstonesTypeError, e.message
end
|
#opposite ⇒ Object
23
24
25
|
# File 'lib/gobstones/lang/commands/sacar.rb', line 23
def opposite
Poner.new(argument)
end
|
#undo(context) ⇒ Object
17
18
19
20
21
|
# File 'lib/gobstones/lang/commands/sacar.rb', line 17
def undo(context)
with_evaluated_argument_in(context) do |result|
context.head.put result
end
end
|