module SimpleListing::Filterable::ClassMethods

Attributes

filterable_keys[R]
filtering_handlers[R]

Public Instance Methods

filter_by(key, handler_proc) click to toggle source
# File lib/simple_listing/filterable.rb, line 15
def filter_by(key, handler_proc)
  filterable_by key
  @filtering_handlers ||= {}.with_indifferent_access
  @filtering_handlers[key] = handler_proc
end
filterable_by(*keys) click to toggle source
# File lib/simple_listing/filterable.rb, line 9
def filterable_by(*keys)
  @filterable_keys ||= []
  @filterable_keys += keys.map(&:to_s)
  @filterable_keys.uniq!
end