Module: Equation::Additive2
- Defined in:
- lib/equation_grammar.rb
Instance Method Summary collapse
Instance Method Details
#value(ctx:) ⇒ Object
572 573 574 575 576 577 578 579 580 581 582 583 584 |
# File 'lib/equation_grammar.rb', line 572 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 |