Class: RediSearch::Aggregate::Clauses::SortBy::Sortable

Inherits:
RediSearch::ApplicationClause show all
Defined in:
lib/redi_search/aggregate/clauses/sort_by.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(field, order = :asc) ⇒ Sortable



12
13
14
15
16
# File 'lib/redi_search/aggregate/clauses/sort_by.rb', line 12

def initialize(field, order = :asc)
  @field = field.to_s
  @field.prepend("@") unless @field.start_with?("@")
  @order = order.to_sym
end

Instance Method Details

#clauseObject



18
19
20
# File 'lib/redi_search/aggregate/clauses/sort_by.rb', line 18

def clause
  [field, order.to_s.upcase]
end