Class: Katalyst::Tables::Collection::Filtering::Filter

Inherits:
Object
  • Object
show all
Includes:
ActiveRecord::Sanitization::ClassMethods
Defined in:
app/models/concerns/katalyst/tables/collection/filtering.rb

Instance Method Summary collapse

Constructor Details

#initialize(app) ⇒ Filter

Returns a new instance of Filter.



16
17
18
# File 'app/models/concerns/katalyst/tables/collection/filtering.rb', line 16

def initialize(app)
  @app = app
end

Instance Method Details

#call(collection) ⇒ Object



20
21
22
23
24
25
26
# File 'app/models/concerns/katalyst/tables/collection/filtering.rb', line 20

def call(collection)
  collection.instance_variable_get(:@attributes).each_value do |attribute|
    collection.items = attribute.type.filter(collection.items, attribute)
  end

  @app.call(collection)
end