Class: Luoma::NegExpression

Inherits:
PrefixExpression show all
Defined in:
lib/luoma/expression.rb,
sig/luoma/expression.rbs

Instance Attribute Summary

Attributes inherited from Expression

#span, #token

Instance Method Summary collapse

Methods inherited from PrefixExpression

#children, #initialize

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_sObject

Signature:

  • () -> String



392
393
394
# File 'lib/luoma/expression.rb', line 392

def to_s
  "-#{@right}"
end