class CriteriaOperator::BinaryOperator

Operator representing any of the binary conditionals defined in {BinaryOperatorType}.

Attributes

left_operand[RW]

@return [BaseOperator] the left hand side operand

operator_type[RW]

@return [BinaryOperatorType] the type of this operator

right_operand[RW]

@return [BaseOperator] the right hand side operand

Public Class Methods

new(left_operand = nil, right_operand = nil, binary_operator_type = BinaryOperatorType::EQUAL) click to toggle source

The constructor for this operator. Expects the operands and the operator type as parameters. @param [BaseOperator] left_operand the left hand side operand @param [BaseOperator] right_operand the right hand side operand @param [BinaryOperatorType] binary_operator_type the type of this operator @return [Void]

# File lib/criteria_operator/binary_operator.rb, line 38
def initialize(left_operand = nil, right_operand = nil, binary_operator_type = BinaryOperatorType::EQUAL)
  self.left_operand = left_operand
  self.right_operand = right_operand
  self.operator_type = binary_operator_type
end

Public Instance Methods

clone() click to toggle source

Clones an operator with all sub-operators, creating a deep copy. Implementation of the abstract {BaseOperator#clone}. @return [BinaryOperator] the cloned operator

# File lib/criteria_operator/binary_operator.rb, line 47
def clone
  BinaryOperator.new clone_or_nil(self.left_operand), clone_or_nil(self.right_operand), self.operator_type
end