Module: AttrFilters::InstanceMethods

Defined in:
lib/attr_filters/instance_methods.rb

Instance Method Summary collapse

Instance Method Details

#filter!Object



5
6
7
8
9
10
11
12
13
# File 'lib/attr_filters/instance_methods.rb', line 5

def filter!
  self.class._registered_filters.each_pair do |filter_name, params|
    filter = build_filter(filter_name)
    params[:attributes].each do |attr|
      value = send(attr)
      send("#{attr}=", filter.call(value, params[:options]))
    end
  end
end