Class: CriteriaOperator::BinaryOperator
- Inherits:
-
BaseOperator
- Object
- BaseOperator
- CriteriaOperator::BinaryOperator
- Defined in:
- lib/criteria_operator/binary_operator.rb
Overview
Operator representing any of the binary conditionals defined in BinaryOperatorType.
Instance Attribute Summary collapse
-
#left_operand ⇒ BaseOperator
The left hand side operand.
-
#operator_type ⇒ BinaryOperatorType
The type of this operator.
-
#right_operand ⇒ BaseOperator
The right hand side operand.
Instance Method Summary collapse
-
#clone ⇒ BinaryOperator
Clones an operator with all sub-operators, creating a deep copy.
-
#initialize(left_operand = nil, right_operand = nil, binary_operator_type = BinaryOperatorType::EQUAL) ⇒ Void
constructor
The constructor for this operator.
Methods inherited from BaseOperator
deserialize, serialize, #serialize
Constructor Details
#initialize(left_operand = nil, right_operand = nil, binary_operator_type = BinaryOperatorType::EQUAL) ⇒ Void
The constructor for this operator. Expects the operands and the operator type as parameters.
38 39 40 41 42 |
# 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 |
Instance Attribute Details
#left_operand ⇒ BaseOperator
Returns the left hand side operand.
28 29 30 |
# File 'lib/criteria_operator/binary_operator.rb', line 28 def left_operand @left_operand end |
#operator_type ⇒ BinaryOperatorType
Returns the type of this operator.
25 26 27 |
# File 'lib/criteria_operator/binary_operator.rb', line 25 def operator_type @operator_type end |
#right_operand ⇒ BaseOperator
Returns the right hand side operand.
31 32 33 |
# File 'lib/criteria_operator/binary_operator.rb', line 31 def right_operand @right_operand end |
Instance Method Details
#clone ⇒ BinaryOperator
Clones an operator with all sub-operators, creating a deep copy. Implementation of the abstract CriteriaOperator::BaseOperator#clone.
47 48 49 |
# 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 |