class DataMapper::Query::Conditions::AndOperation
Public Instance Methods
matches?(record)
click to toggle source
Match the record
@example with a Hash
operation.matches?({ :id => 1 }) # => true
@example with a Resource
operation.matches?(Blog::Article.new(:id => 1)) # => true
@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 460 def matches?(record) all? { |op| op.respond_to?(:matches?) ? op.matches?(record) : true } end
minimize()
click to toggle source
Minimize the operation
@return [self]
the minimized AndOperation
@return [AbstractOperation, AbstractComparison, Array]
the minimized operation
@api semipublic
# File lib/dm-core/query/conditions/operation.rb, line 472 def minimize minimize_operands return Operation.new(:null) if any? && all? { |op| op.nil? } prune_operands one? ? first : self end