Class: Redis::Commands::Search::PredicateCollection
| Relationships & Source Files | |
| Inherits: | Object |
| Defined in: | lib/redis/commands/modules/search/query.rb |
Overview
An ordered collection of predicates joined with AND (a space) or OR (+ | +).
Class Method Summary
- .new(type) ⇒ PredicateCollection constructor
Instance Attribute Summary
Instance Method Summary
-
#add(predicate) ⇒ Array
Add a predicate (or nested collection) to this collection.
- #to_s ⇒ String
Constructor Details
.new(type) ⇒ PredicateCollection
Instance Attribute Details
#predicates ⇒ Symbol, Array<Predicate, PredicateCollection> (readonly)
# File 'lib/redis/commands/modules/search/query.rb', line 714
attr_reader :type, :predicates
#type ⇒ Symbol, Array<Predicate, PredicateCollection> (readonly)
# File 'lib/redis/commands/modules/search/query.rb', line 714
attr_reader :type, :predicates
Instance Method Details
#add(predicate) ⇒ Array
Add a predicate (or nested collection) to this collection.
# File 'lib/redis/commands/modules/search/query.rb', line 726
def add(predicate) @predicates << predicate end
#to_s ⇒ String
# File 'lib/redis/commands/modules/search/query.rb', line 731
def to_s joiner = @type == :or ? ' | ' : ' ' "(#{@predicates.join(joiner)})" end