Class: Luoma::MulExpression

Inherits:
InfixExpression 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 InfixExpression

#children, #initialize

Methods inherited from Expression

#children, #initialize, #scope

Constructor Details

This class inherits a constructor from Luoma::InfixExpression

Instance Method Details

#evaluate(context) ⇒ Object

Signature:

  • (RenderContext) -> untyped



580
581
582
583
584
# File 'lib/luoma/expression.rb', line 580

def evaluate(context)
  left = context.env.to_numeric(@left.evaluate(context), context, default: :nothing)
  right = context.env.to_numeric(@right.evaluate(context), context, default: :nothing)
  left == :nothing || right == :nothing ? :nothing : left * right # steep:ignore
end

#to_sObject

Signature:

  • () -> String



587
588
589
# File 'lib/luoma/expression.rb', line 587

def to_s
  "#{@left} * #{@right}"
end