Class: ActiveRecord::FilterAttributeHandler
- Inherits:
-
Object
- Object
- ActiveRecord::FilterAttributeHandler
- Defined in:
- lib/active_record/filter_attribute_handler.rb
Overview
:nodoc:
Class Method Summary collapse
- .on_sensitive_attribute_declared(&block) ⇒ Object
- .sensitive_attribute_was_declared(klass, list) ⇒ Object
Instance Method Summary collapse
- #enable ⇒ Object
-
#initialize(app) ⇒ FilterAttributeHandler
constructor
A new instance of FilterAttributeHandler.
Constructor Details
#initialize(app) ⇒ FilterAttributeHandler
Returns a new instance of FilterAttributeHandler.
18 19 20 21 22 |
# File 'lib/active_record/filter_attribute_handler.rb', line 18 def initialize(app) @app = app @attributes_by_class = Concurrent::Map.new @collecting = true end |
Class Method Details
.on_sensitive_attribute_declared(&block) ⇒ Object
6 7 8 9 |
# File 'lib/active_record/filter_attribute_handler.rb', line 6 def on_sensitive_attribute_declared(&block) @sensitive_attribute_declaration_listeners ||= Concurrent::Array.new @sensitive_attribute_declaration_listeners << block end |
.sensitive_attribute_was_declared(klass, list) ⇒ Object
11 12 13 14 15 |
# File 'lib/active_record/filter_attribute_handler.rb', line 11 def sensitive_attribute_was_declared(klass, list) @sensitive_attribute_declaration_listeners&.each do |block| block.call(klass, list) end end |
Instance Method Details
#enable ⇒ Object
24 25 26 27 28 29 |
# File 'lib/active_record/filter_attribute_handler.rb', line 24 def enable install_collecting_hook apply_collected_attributes @collecting = false end |