Class: Code::Node::UnaryMinus
- Inherits:
-
Code::Node
- Object
- Code::Node
- Code::Node::UnaryMinus
- Defined in:
- lib/code/node/unary_minus.rb
Instance Method Summary collapse
- #evaluate(**args) ⇒ Object
-
#initialize(parsed) ⇒ UnaryMinus
constructor
A new instance of UnaryMinus.
Methods inherited from Code::Node
Constructor Details
#initialize(parsed) ⇒ UnaryMinus
Returns a new instance of UnaryMinus.
6 7 8 9 10 |
# File 'lib/code/node/unary_minus.rb', line 6 def initialize(parsed) @operator = parsed.delete(:operator) @right = Node::Statement.new(parsed.delete(:right)) super(parsed) end |
Instance Method Details
#evaluate(**args) ⇒ Object
12 13 14 |
# File 'lib/code/node/unary_minus.rb', line 12 def evaluate(**args) @right.evaluate(**args).call(operator: @operator, arguments: [], **args) end |