Class: UnaryNode

Inherits:
Object
  • Object
show all
Defined in:
lib/nodes.rb

Instance Method Summary collapse

Constructor Details

#initialize(op, operand) ⇒ UnaryNode

Returns a new instance of UnaryNode.



223
224
225
226
# File 'lib/nodes.rb', line 223

def initialize(op, operand)
  @op = op
  @operand = operand
end

Instance Method Details

#evaluate(scope) ⇒ Object



227
228
229
# File 'lib/nodes.rb', line 227

def evaluate(scope)
  return eval("#{@op}#{@operand.evaluate(scope)}") # Not possible to use send-method.
end