Class: DataMapper::Query::Conditions::OrOperation
- Inherits:
-
AbstractOperation
- Object
- AbstractOperation
- DataMapper::Query::Conditions::OrOperation
- Includes:
- FlattenOperation
- Defined in:
- lib/dm-core/query/conditions/operation.rb
Instance Attribute Summary
Attributes inherited from AbstractOperation
Instance Method Summary collapse
-
#matches?(record) ⇒ boolean
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) ⇒ boolean
Match the record
491 492 493 |
# File 'lib/dm-core/query/conditions/operation.rb', line 491 def matches?(record) any? { |op| op.respond_to?(:matches?) ? op.matches?(record) : true } end |
#minimize ⇒ self, ...
Minimize the operation
515 516 517 518 519 520 521 522 523 |
# File 'lib/dm-core/query/conditions/operation.rb', line 515 def minimize minimize_operands return Operation.new(:null) if any?(&: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.
503 504 505 |
# File 'lib/dm-core/query/conditions/operation.rb', line 503 def valid? any? { |op| valid_operand?(op) } end |