Module: Equation::Multitive2
- Defined in:
- lib/equation_grammar.rb
Instance Method Summary collapse
Instance Method Details
#value(ctx:) ⇒ Object
704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 |
# File 'lib/equation_grammar.rb', line 704 def value(ctx:) base = head.value(ctx: ctx) tail.elements.each do |k| case k.operator.text_value when '*' base *= k.operand.value(ctx: ctx) when '/' base /= k.operand.value(ctx: ctx) when '%' base %= k.operand.value(ctx: ctx) end end base end |