Class: Restfulness::Sanitizer::AbstractSanitizer
- Inherits:
-
Object
- Object
- Restfulness::Sanitizer::AbstractSanitizer
- Defined in:
- lib/restfulness/sanitizer.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#sensitive_param_matcher ⇒ Object
readonly
Returns the value of attribute sensitive_param_matcher.
-
#sensitive_params ⇒ Object
readonly
Returns the value of attribute sensitive_params.
Instance Method Summary collapse
-
#initialize(*sensitive_params) ⇒ AbstractSanitizer
constructor
A new instance of AbstractSanitizer.
- #sanitize(arg) ⇒ Object
- #sensitive_param?(param) ⇒ Boolean
Constructor Details
#initialize(*sensitive_params) ⇒ AbstractSanitizer
Returns a new instance of AbstractSanitizer.
18 19 20 21 |
# File 'lib/restfulness/sanitizer.rb', line 18 def initialize(*sensitive_params) @sensitive_params = [*sensitive_params].flatten.map(&:downcase) @sensitive_param_matcher = Regexp.new("\\A#{@sensitive_params.join('|')}", Regexp::IGNORECASE) end |
Instance Attribute Details
#sensitive_param_matcher ⇒ Object (readonly)
Returns the value of attribute sensitive_param_matcher
16 17 18 |
# File 'lib/restfulness/sanitizer.rb', line 16 def sensitive_param_matcher @sensitive_param_matcher end |
#sensitive_params ⇒ Object (readonly)
Returns the value of attribute sensitive_params
16 17 18 |
# File 'lib/restfulness/sanitizer.rb', line 16 def sensitive_params @sensitive_params end |
Instance Method Details
#sanitize(arg) ⇒ Object
27 28 29 |
# File 'lib/restfulness/sanitizer.rb', line 27 def sanitize(arg) raise 'not implemented' end |
#sensitive_param?(param) ⇒ Boolean
23 24 25 |
# File 'lib/restfulness/sanitizer.rb', line 23 def sensitive_param?(param) sensitive_param_matcher === param.to_s end |