Class: DataMapper::Query::Conditions::OrOperation
- Inherits:
-
AbstractOperation
- Object
- AbstractOperation
- DataMapper::Query::Conditions::OrOperation
- Includes:
- FlattenOperation
- Defined in:
- lib/dm-core/query/conditions/operation.rb
Overview
class AndOperation
Instance Attribute Summary
Attributes inherited from AbstractOperation
Instance Method Summary collapse
-
#matches?(record) ⇒ true
Match the record.
-
#minimize ⇒ self, ...
Minimize the operation.
-
#valid? ⇒ Boolean
Test if the operation is valid.
Methods included from FlattenOperation
Methods inherited from AbstractOperation
#<<, #clear, descendants, #difference, #each, #empty?, #first, inherited, #intersection, #merge, #negated?, #one?, #slug, slug, #sorted_operands, #to_s, #union
Methods included from Equalizer
Methods included from Assertions
Instance Method Details
#matches?(record) ⇒ true
Match the record
497 498 499 |
# 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 ⇒ self, ...
Minimize the operation
521 522 523 524 525 526 527 528 529 |
# 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? ⇒ Boolean
Test if the operation is valid
An OrOperation is valid if one of it’s operands is valid.
509 510 511 |
# File 'lib/dm-core/query/conditions/operation.rb', line 509 def valid? any? { |op| valid_operand?(op) } end |