Class: Rnotifier::ParameterFilter
- Inherits:
-
Object
- Object
- Rnotifier::ParameterFilter
- Defined in:
- lib/rnotifier/parameter_filter.rb
Constant Summary collapse
- DEFAULT_FIELDS =
[:password, :password_confirmation, :authorization, :secret, :passwd]
- FILTERED =
'[FILTERED]'
Class Method Summary collapse
Instance Method Summary collapse
- #filter(params) ⇒ Object
-
#initialize(filters) ⇒ ParameterFilter
constructor
A new instance of ParameterFilter.
Constructor Details
#initialize(filters) ⇒ ParameterFilter
Returns a new instance of ParameterFilter.
17 18 19 |
# File 'lib/rnotifier/parameter_filter.rb', line 17 def initialize(filters) @filters = filters end |
Class Method Details
.default_filter(params) ⇒ Object
12 13 14 15 |
# File 'lib/rnotifier/parameter_filter.rb', line 12 def self.default_filter(params) @default_filter ||= ParameterFilter.new(DEFAULT_FIELDS) @default_filter.filter(params) end |
.filter(params, filters) ⇒ Object
7 8 9 10 |
# File 'lib/rnotifier/parameter_filter.rb', line 7 def self.filter(params, filters) @filter ||= ParameterFilter.new(filters) @filter.filter(params) end |
Instance Method Details
#filter(params) ⇒ Object
21 22 23 24 25 26 27 |
# File 'lib/rnotifier/parameter_filter.rb', line 21 def filter(params) if @filters && !@filters.empty? compiled_filter.call(params) else params end end |