Class: RediSearch::Aggregate::Reducers::Max

Inherits:
RediSearch::ApplicationClause show all
Defined in:
lib/redi_search/aggregate/reducers/max.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(property:, as:) ⇒ Max

Returns a new instance of Max.



10
11
12
13
14
# File 'lib/redi_search/aggregate/reducers/max.rb', line 10

def initialize(property:, as:)
  @property = property.to_s
  @property.prepend("@") unless @property.start_with?("@")
  @as = as
end

Instance Method Details

#clauseObject



16
17
18
19
20
21
22
# File 'lib/redi_search/aggregate/reducers/max.rb', line 16

def clause
  validate!

  command =  ["REDUCE", "MAX", 1, property]
  command += ["AS", as] if as
  command
end