Module: Cuprum::Collections::Scopes::Disjunction
- Includes:
- Container
- Included in:
- Basic::Scopes::DisjunctionScope, DisjunctionScope
- Defined in:
- lib/cuprum/collections/scopes/disjunction.rb
Overview
Functionality for implementing a logical OR scope.
Instance Attribute Summary
Attributes included from Container
Instance Method Summary collapse
-
#invert ⇒ Cuprum::Collections::Disjunction
A logical AND scope with the constituent scopes inverted.
- #or(*args) ⇒ Object
-
#type ⇒ Symbol
The scope type.
Methods included from Container
#==, #as_json, #debug, #empty?, #initialize, #with_scopes
Instance Method Details
#invert ⇒ Cuprum::Collections::Disjunction
Returns a logical AND scope with the constituent scopes inverted.
13 14 15 |
# File 'lib/cuprum/collections/scopes/disjunction.rb', line 13 def invert builder.build_conjunction_scope(scopes: scopes.map(&:invert)) end |
#and(hash = nil, &block) ⇒ Object #and(scope) ⇒ Object
18 19 20 21 22 23 24 |
# File 'lib/cuprum/collections/scopes/disjunction.rb', line 18 def or(*args, &) return super if scope?(args.first) scope = builder.build(*args, &) with_scopes([*scopes, scope]) end |
#type ⇒ Symbol
Returns the scope type.
27 28 29 |
# File 'lib/cuprum/collections/scopes/disjunction.rb', line 27 def type :disjunction end |