class CriteriaOperator::UnaryOperator

Operator representing an unary operation.

Attributes

operand[RW]

@return [BaseOperator] the operand

operator_type[RW]

@return [UnaryOperatorType] the type of this operator

Public Class Methods

new(operand = nil, unary_operator_type = UnaryOperatorType::NOT) click to toggle source

The constructor for this operator. Expects the operand and the operator type as parameters. @param [BaseOperator] operand the operand @param [UnaryOperatorType] unary_operator_type the type of this operator @return [Void]

# 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

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 [UnaryOperator] the cloned operator

# File lib/criteria_operator/unary_operator.rb, line 38
def clone
  UnaryOperator.new clone_or_nil(self.operand), self.operator_type
end