Class: ActiveRecord::FilterAttributeHandler

Inherits:
Object
  • Object
show all
Defined in:
lib/active_record/filter_attribute_handler.rb

Overview

:nodoc:

Class Method Summary collapse

Instance Method Summary collapse

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

#enableObject



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