Class: Gobstones::Lang::Div
- Inherits:
-
ArithmeticExpression
- Object
- Expression
- TwoArgExpression
- ArithmeticExpression
- Gobstones::Lang::Div
- Defined in:
- lib/gobstones/lang/expressions/arithmetic_expressions.rb
Instance Attribute Summary
Attributes inherited from TwoArgExpression
Instance Method Summary collapse
Methods inherited from ArithmeticExpression
Methods inherited from TwoArgExpression
#equality_attributes, evaluates_with, #initialize
Methods inherited from Expression
Methods included from EqualityDefinition
Constructor Details
This class inherits a constructor from Gobstones::Lang::TwoArgExpression
Instance Method Details
#evaluate(context) ⇒ Object
27 28 29 30 31 |
# File 'lib/gobstones/lang/expressions/arithmetic_expressions.rb', line 27 def evaluate(context) left_expr.evaluate(context) / right_expr.evaluate(context) rescue ZeroDivisionError raise Runner::GobstonesRuntimeError, 'zero division' end |