Class: UnaryNode
- Inherits:
-
Object
- Object
- UnaryNode
- Defined in:
- lib/nodes.rb
Overview
Class for unary expressions.
Instance Method Summary collapse
- #evaluate(scope) ⇒ Object
-
#initialize(op, operand) ⇒ UnaryNode
constructor
A new instance of UnaryNode.
Constructor Details
#initialize(op, operand) ⇒ UnaryNode
Returns a new instance of UnaryNode.
283 284 285 286 |
# File 'lib/nodes.rb', line 283 def initialize(op, operand) @op = op @operand = operand end |
Instance Method Details
#evaluate(scope) ⇒ Object
287 288 289 |
# File 'lib/nodes.rb', line 287 def evaluate(scope) return eval("#{@op}#{@operand.evaluate(scope)}") end |