Module: Equation::Additive2
- Defined in:
- lib/equation_grammar.rb
Instance Method Summary collapse
Instance Method Details
#value(ctx:) ⇒ Object
580 581 582 583 584 585 586 587 588 589 590 591 592 |
# File 'lib/equation_grammar.rb', line 580 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) end end base end |