Add an operand to the operation
This will only allow a single operand to be added.
@param [AbstractOperation, AbstractComparison, Array] operand
the operand to add
@return [self]
the operation
@api semipublic
# File lib/dm-core/query/conditions/operation.rb, line 560 def <<(operand) assert_one_operand(operand) assert_no_self_reference(operand) super end
Match the record
@param [Resource, Hash] record
the resource to match
@return [true]
true if the record matches, false if not
@api semipublic
# File lib/dm-core/query/conditions/operation.rb, line 544 def matches?(record) operand = self.operand operand.respond_to?(:matches?) ? !operand.matches?(record) : true end
Minimize the operation
@return [self]
the minimized NotOperation
@return [AbstractOperation, AbstractComparison, Array]
the minimized operation
@api semipublic
# File lib/dm-core/query/conditions/operation.rb, line 584 def minimize minimize_operands prune_operands # factor out double negatives if possible operand = self.operand one? && instance_of?(operand.class) ? operand.operand : self end
Test if the operation is negated
Defaults to return false.
@return [Boolean]
true if the operation is negated, false if not
@api private
# File lib/dm-core/query/conditions/operation.rb, line 611 def negated? parent = self.parent parent ? !parent.negated? : true end
Return the only operand in the operation
@return [AbstractOperation, AbstractComparison, Array]
the operand
@api semipublic
# File lib/dm-core/query/conditions/operation.rb, line 572 def operand first end
Generated with the Darkfish Rdoc Generator 2.