class FormulaDSL::BinaryExpression

Attributes

left_term[R]
operator[R]
right_term[R]

Public Class Methods

new(operator, left_term, right_term) click to toggle source
# File lib/formula_dsl/binary_expression.rb, line 7
def initialize(operator, left_term, right_term)
  @operator = operator
  @left_term = left_term
  @right_term = right_term
end

Public Instance Methods

==(other) click to toggle source
# File lib/formula_dsl/binary_expression.rb, line 21
def == (other)
  @operator == other.operator && @left_term == other.left_term && @right_term == other.right_term
end
apply() click to toggle source
# File lib/formula_dsl/binary_expression.rb, line 13
def apply
  @left_term = @left_term.apply if @left_term.respond_to? :apply
  @right_term = @right_term.apply if @right_term.respond_to? :apply
  operation = BinaryExpressionFactory.new(@operator)

  operation.call(@left_term, @right_term)
end