module FormulaDSL::BinaryExpressionFactory

Public Class Methods

new(operator) click to toggle source
# File lib/formula_dsl/binary_expression_factory.rb, line 9
def self.new(operator)
  operation = case operator
              when :+ then ::FormulaDSL::BinaryOperations::ADDITION
              when :- then ::FormulaDSL::BinaryOperations::SUBTRACTION
              when :* then ::FormulaDSL::BinaryOperations::MULTIPLICATION
              when :/ then ::FormulaDSL::BinaryOperations::DIVISION
              else raise MissingBinaryOperationError, "Sorry, but we don't have a implementation for the operator ( #{operator} )."
              end

  operation
end