class CriteriaOperator::GroupOperator

Operator that groups multiple operators using one grouping type.

Attributes

operand_collection[RW]

@return [Array<BaseOperator>] the collection of operands grouped by this operator

operator_type[RW]

@return [GroupOperatorType] the type of this operator

Public Class Methods

new(operands = [], group_operator_type = GroupOperatorType::AND) click to toggle source

The constructor for this operator. Expects a collection of operands and the operator type as parameters. @param [Array<BaseOperator>] operands a collection of operands to group together @param [GroupOperatorType] group_operator_type the type of this operator @return [Void]

# File lib/criteria_operator/group_operator.rb, line 26
def initialize(operands = [], group_operator_type = GroupOperatorType::AND)
  self.operand_collection = operands
  self.operator_type = group_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 [GroupOperator] the cloned operator

# File lib/criteria_operator/group_operator.rb, line 34
def clone
  ops = []
  self.operand_collection.each { |op| ops << clone_or_nil(op) }
  GroupOperator.new ops, self.operator_type
end