File: arithmetic_node_classes.rb

package info (click to toggle)
ruby-treetop 1.6.14-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 956 kB
  • sloc: ruby: 8,918; makefile: 5
file content (9 lines) | stat: -rw-r--r-- 250 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
module Arithmetic
  class BinaryOperation < Treetop::Runtime::SyntaxNode
    def eval(env={})
      tail.elements.inject(head.eval(env)) do |value, element|
        element.operator.apply(value, element.operand.eval(env))
      end
    end
  end
end