Class: AuditLogger::ActorContextResolver

Inherits:
Object
  • Object
show all
Defined in:
lib/audit_logger/actor_context_resolver.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(configuration) ⇒ ActorContextResolver

Returns a new instance of ActorContextResolver.



9
10
11
# File 'lib/audit_logger/actor_context_resolver.rb', line 9

def initialize(configuration)
  @configuration = configuration
end

Class Method Details

.call(configuration) ⇒ Object



5
6
7
# File 'lib/audit_logger/actor_context_resolver.rb', line 5

def self.call(configuration)
  new(configuration).call
end

Instance Method Details

#callObject

Resolve todos os campos de contexto do ator em um unico ponto.



14
15
16
17
18
19
20
21
22
# File 'lib/audit_logger/actor_context_resolver.rb', line 14

def call
  {
    changed_by_id: call_resolver(:changed_by_id, configuration.changed_by_id_resolver),
    changed_by_type: call_resolver(:changed_by_type, configuration.changed_by_type_resolver),
    changed_by_other: normalize_json_object(call_resolver(:changed_by_other, configuration.changed_by_other_resolver)),
    uuid: resolve_uuid,
    ip_remote: call_resolver(:ip_remote, configuration.ip_resolver)
  }
end