class DataMapper::Query::Conditions::OrOperation

Public Instance Methods

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 497
def matches?(record)
  any? { |op| op.respond_to?(:matches?) ? op.matches?(record) : true }
end
minimize() click to toggle source

Minimize the operation

@return [self]

the minimized OrOperation

@return [AbstractOperation, AbstractComparison, Array]

the minimized operation

@api semipublic

# File lib/dm-core/query/conditions/operation.rb, line 521
def minimize
  minimize_operands

  return Operation.new(:null) if any? { |op| op.nil? }

  prune_operands

  one? ? first : self
end
valid?() click to toggle source

Test if the operation is valid

An OrOperation is valid if one of it's operands is valid.

@return [Boolean]

true if the operation is valid, false if not

@api semipublic

# File lib/dm-core/query/conditions/operation.rb, line 509
def valid?
  any? { |op| valid_operand?(op) }
end