Class: CriteriaOperator::UnaryOperator
- Inherits:
-
BaseOperator
- Object
- BaseOperator
- CriteriaOperator::UnaryOperator
- Defined in:
- lib/criteria_operator/unary_operator.rb
Overview
Operator representing an unary operation.
Instance Attribute Summary collapse
-
#operand ⇒ BaseOperator
The operand.
-
#operator_type ⇒ UnaryOperatorType
The type of this operator.
Instance Method Summary collapse
-
#clone ⇒ UnaryOperator
Clones an operator with all sub-operators, creating a deep copy.
-
#initialize(operand = nil, unary_operator_type = UnaryOperatorType::NOT) ⇒ Void
constructor
The constructor for this operator.
Methods inherited from BaseOperator
deserialize, serialize, #serialize
Constructor Details
#initialize(operand = nil, unary_operator_type = UnaryOperatorType::NOT) ⇒ Void
The constructor for this operator. Expects the operand and the operator type as parameters.
30 31 32 33 |
# File 'lib/criteria_operator/unary_operator.rb', line 30 def initialize(operand = nil, unary_operator_type = UnaryOperatorType::NOT) self.operand = operand self.operator_type = unary_operator_type end |
Instance Attribute Details
#operand ⇒ BaseOperator
Returns the operand.
24 25 26 |
# File 'lib/criteria_operator/unary_operator.rb', line 24 def operand @operand end |
#operator_type ⇒ UnaryOperatorType
Returns the type of this operator.
21 22 23 |
# File 'lib/criteria_operator/unary_operator.rb', line 21 def operator_type @operator_type end |
Instance Method Details
#clone ⇒ UnaryOperator
Clones an operator with all sub-operators, creating a deep copy. Implementation of the abstract BaseOperator#clone.
38 39 40 |
# File 'lib/criteria_operator/unary_operator.rb', line 38 def clone UnaryOperator.new clone_or_nil(self.operand), self.operator_type end |