Class: Luoma::NegExpression
- Inherits:
-
PrefixExpression
- Object
- Expression
- PrefixExpression
- Luoma::NegExpression
- Defined in:
- lib/luoma/expression.rb,
sig/luoma/expression.rbs
Instance Attribute Summary
Attributes inherited from Expression
Instance Method Summary collapse
Methods inherited from PrefixExpression
Methods inherited from Expression
#children, #initialize, #scope
Constructor Details
This class inherits a constructor from Luoma::PrefixExpression
Instance Method Details
#evaluate(context) ⇒ Object
386 387 388 389 |
# File 'lib/luoma/expression.rb', line 386 def evaluate(context) right = context.env.to_numeric(@right.evaluate(context), context, default: :nothing) context.env.nothing?(right) ? :nothing : -right # steep:ignore end |
#to_s ⇒ Object
392 393 394 |
# File 'lib/luoma/expression.rb', line 392 def to_s "-#{@right}" end |