blambeau/finitio-rb

View on GitHub
lib/finitio/syntax/expr/arith_op.rb

Summary

Maintainability
A
45 mins
Test Coverage
module Finitio
  module Syntax
    module Expr
      module ArithOp
        include Expr

        capture :left, :op, :right

        def to_proc_source
          l, r = left.to_proc_source, right.to_proc_source
          "#{l}.#{op.to_str.strip}(#{r})"
        end

        def _free_variables(fvs)
          left._free_variables(fvs)
          right._free_variables(fvs)
        end

      end # module ArithOp
    end # module Expr
  end # module Syntax
end # module Finitio