Class/Module Index [+]

Quicksearch

DataMapper::Query::Conditions::NotOperation

Public Instance Methods

<<(operand) click to toggle source

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
matches?(record) click to toggle source

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() click to toggle source

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
negated?() click to toggle source

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
operand() click to toggle source

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
to_s() click to toggle source

Return the string representation of the operation

@return [String]

the string representation of the operation

@api semipublic

# File lib/dm-core/query/conditions/operation.rb, line 599
def to_s
  empty? ? '' : "NOT(#{operand.to_s})"
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.