Class: RediSearch::Aggregate::Reducers::Count

Inherits:
RediSearch::ApplicationClause show all
Defined in:
lib/redi_search/aggregate/reducers/count.rb

Instance Method Summary collapse

Methods inherited from RediSearch::ApplicationClause

#clause_order, clause_order, clause_term

Methods included from Validatable

included, #validate!

Constructor Details

#initialize(as:) ⇒ Count

Returns a new instance of Count.



9
10
11
# File 'lib/redi_search/aggregate/reducers/count.rb', line 9

def initialize(as:)
  @as = as
end

Instance Method Details

#clauseObject



13
14
15
16
17
18
19
# File 'lib/redi_search/aggregate/reducers/count.rb', line 13

def clause
  validate!

  command =  ["REDUCE", "COUNT", 0]
  command += ["AS", as] if as
  command
end