Class: RediSearch::Aggregate::Reducers::Min

Inherits:
RediSearch::ApplicationClause show all
Defined in:
lib/redi_search/aggregate/reducers/min.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:) ⇒ Min

Returns a new instance of Min.



10
11
12
13
14
# File 'lib/redi_search/aggregate/reducers/min.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/min.rb', line 16

def clause
  validate!

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