Class: Devise::BaseSanitizer
- Inherits:
-
Object
- Object
- Devise::BaseSanitizer
- Defined in:
- lib/devise/parameter_sanitizer.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#params ⇒ Object
readonly
Returns the value of attribute params.
-
#resource_class ⇒ Object
readonly
Returns the value of attribute resource_class.
-
#resource_name ⇒ Object
readonly
Returns the value of attribute resource_name.
Instance Method Summary collapse
- #for(kind, &block) ⇒ Object
-
#initialize(resource_class, resource_name, params) ⇒ BaseSanitizer
constructor
A new instance of BaseSanitizer.
Constructor Details
#initialize(resource_class, resource_name, params) ⇒ BaseSanitizer
Returns a new instance of BaseSanitizer.
5 6 7 8 9 10 |
# File 'lib/devise/parameter_sanitizer.rb', line 5 def initialize(resource_class, resource_name, params) @resource_class = resource_class @resource_name = resource_name @params = params @blocks = Hash.new end |
Instance Attribute Details
#params ⇒ Object (readonly)
Returns the value of attribute params.
3 4 5 |
# File 'lib/devise/parameter_sanitizer.rb', line 3 def params @params end |
#resource_class ⇒ Object (readonly)
Returns the value of attribute resource_class.
3 4 5 |
# File 'lib/devise/parameter_sanitizer.rb', line 3 def resource_class @resource_class end |
#resource_name ⇒ Object (readonly)
Returns the value of attribute resource_name.
3 4 5 |
# File 'lib/devise/parameter_sanitizer.rb', line 3 def resource_name @resource_name end |
Instance Method Details
#for(kind, &block) ⇒ Object
12 13 14 15 16 17 18 19 |
# File 'lib/devise/parameter_sanitizer.rb', line 12 def for(kind, &block) if block_given? @blocks[kind] = block else block = @blocks[kind] block ? block.call(default_params) : fallback_for(kind) end end |