Class: AuditLoggable::Sweeper
- Inherits:
-
Object
- Object
- AuditLoggable::Sweeper
- Defined in:
- lib/audit_loggable/sweeper.rb
Constant Summary collapse
- STORED_DATA =
{ current_remote_address: :remote_ip, current_request_uuid: :request_uuid, current_user: :current_user }.freeze
Instance Method Summary collapse
- #around(controller, &block) ⇒ Object
-
#initialize(current_user_methods: %i[current_user])) ⇒ Sweeper
constructor
A new instance of Sweeper.
Constructor Details
#initialize(current_user_methods: %i[current_user])) ⇒ Sweeper
Returns a new instance of Sweeper.
11 12 13 |
# File 'lib/audit_loggable/sweeper.rb', line 11 def initialize(current_user_methods: %i[current_user]) @current_user_methods = ::Array.wrap(current_user_methods).map(&:to_sym) end |
Instance Method Details
#around(controller, &block) ⇒ Object
15 16 17 18 19 20 21 22 23 24 |
# File 'lib/audit_loggable/sweeper.rb', line 15 def around(controller, &block) Store.set({ current_controller: controller }) do Store.set( STORED_DATA .each_pair .with_object({}) { |(k, m), h| h[k] = __send__(m) }, &block ) end end |