Class: Liquid2::Divide

Inherits:
ArithmeticExpression show all
Defined in:
lib/liquid2/expressions/arithmetic.rb

Overview

Infix division

Instance Attribute Summary

Attributes inherited from Expression

#token

Instance Method Summary collapse

Methods inherited from ArithmeticExpression

#children, #initialize

Methods inherited from Expression

#children, #initialize, #scope

Constructor Details

This class inherits a constructor from Liquid2::ArithmeticExpression

Instance Method Details

#evaluate(context) ⇒ Object



56
57
58
59
60
61
# File 'lib/liquid2/expressions/arithmetic.rb', line 56

def evaluate(context)
  left, right = inner_evaluate(context)
  left / right
rescue ZeroDivisionError => e
  raise LiquidTypeError.new(e.message, nil)
end