Class: RediSearch::Aggregate::Reducers::Average
- Inherits:
-
RediSearch::ApplicationClause
- Object
- RediSearch::ApplicationClause
- RediSearch::Aggregate::Reducers::Average
- Defined in:
- lib/redi_search/aggregate/reducers/average.rb
Instance Method Summary collapse
- #clause ⇒ Object
-
#initialize(property:, as:) ⇒ Average
constructor
A new instance of Average.
Methods inherited from RediSearch::ApplicationClause
#clause_order, clause_order, clause_term
Methods included from Validatable
Constructor Details
#initialize(property:, as:) ⇒ Average
Returns a new instance of Average.
10 11 12 13 14 |
# File 'lib/redi_search/aggregate/reducers/average.rb', line 10 def initialize(property:, as:) @property = property.to_s @property.prepend("@") unless @property.start_with?("@") @as = as end |
Instance Method Details
#clause ⇒ Object
16 17 18 19 20 21 22 |
# File 'lib/redi_search/aggregate/reducers/average.rb', line 16 def clause validate! command = ["REDUCE", "AVG", 1, property] command += ["AS", as] if as command end |