Module: Toller

Extended by:
ActiveSupport::Concern
Defined in:
lib/toller.rb,
lib/toller/sort.rb,
lib/toller/filter.rb,
lib/toller/version.rb,
lib/toller/retriever.rb,
lib/toller/sorts/order_handler.rb,
lib/toller/sorts/scope_handler.rb,
lib/toller/filters/mutators/date.rb,
lib/toller/filters/mutators/time.rb,
lib/toller/filters/scope_handler.rb,
lib/toller/filters/where_handler.rb,
lib/toller/filters/mutators/boolean.rb,
lib/toller/filters/mutators/integer.rb,
lib/toller/filters/mutators/datetime.rb

Overview

Toller

Query param based filtering and sorting

Defined Under Namespace

Modules: Filters, Sorts Classes: Filter, Retriever, Sort

Constant Summary collapse

VERSION =
'0.5.0'

Instance Method Summary collapse

Instance Method Details

#filter_param_keyObject



54
55
56
# File 'lib/toller.rb', line 54

def filter_param_key
  :filters
end

#filter_paramsObject



46
47
48
# File 'lib/toller.rb', line 46

def filter_params
  params.fetch(filter_param_key.to_sym, {})
end

#retrieve(collection) ⇒ Object



24
25
26
# File 'lib/toller.rb', line 24

def retrieve(collection)
  Retriever.filter(collection, filter_params, sort_params, retrievals)
end

#sort_param_keyObject



58
59
60
# File 'lib/toller.rb', line 58

def sort_param_key
  :sort
end

#sort_paramsObject



50
51
52
# File 'lib/toller.rb', line 50

def sort_params
  params.fetch(sort_param_key.to_sym, '').split(',')
end