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