Class: UnaryNode
- Inherits:
-
Object
- Object
- UnaryNode
- Defined in:
- lib/nodes.rb
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.
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 |