Module: MightyGrid::Filters

Extended by:
ActiveSupport::Autoload
Included in:
Base
Defined in:
lib/mighty_grid/filters.rb,
lib/mighty_grid/filters/base.rb,
lib/mighty_grid/filters/enum_filter.rb,
lib/mighty_grid/filters/text_filter.rb,
lib/mighty_grid/filters/custom_filter.rb,
lib/mighty_grid/filters/search_filter.rb,
lib/mighty_grid/filters/string_filter.rb,
lib/mighty_grid/filters/boolean_filter.rb

Defined Under Namespace

Modules: ClassMethods, InstanceMethods Classes: Base, BooleanFilter, CustomFilter, EnumFilter, SearchFilter, StringFilter, TextFilter

Class Method Summary collapse

Class Method Details

.included(base) ⇒ Object



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/mighty_grid/filters.rb', line 16

def self.included(base)
  base.class_eval do
    class_attribute :filters
    class_attribute :query
    class_attribute :search_name
    self.filters = {}
    self.query = nil
    self.search_name = nil

    extend MapType
    map_type :string, to: MightyGrid::Filters::StringFilter
    map_type :text, to: MightyGrid::Filters::TextFilter
    map_type :enum, to: MightyGrid::Filters::EnumFilter
    map_type :boolean, to: MightyGrid::Filters::BooleanFilter
    map_type :custom, to: MightyGrid::Filters::CustomFilter
    map_type :search, to: MightyGrid::Filters::SearchFilter
  end

  base.send :extend, ClassMethods
  base.send :include, InstanceMethods
end