Class: ActionAudit::Factory

Inherits:
Object
  • Object
show all
Defined in:
lib/action_audit/factory.rb

Class Method Summary collapse

Class Method Details

.add_change(*args) ⇒ Object



27
28
29
# File 'lib/action_audit/factory.rb', line 27

def add_change(*args)
  current.add_change(*args) if current
end

.add_params(*args) ⇒ Object



23
24
25
# File 'lib/action_audit/factory.rb', line 23

def add_params(*args)
  current.add_params(*args) if current
end

.currentObject



3
4
5
# File 'lib/action_audit/factory.rb', line 3

def current
  Thread.current[:action_auditor]
end

.flushObject



11
12
13
# File 'lib/action_audit/factory.rb', line 11

def flush
  Thread.current[:action_auditor] = nil
end

.startObject



7
8
9
# File 'lib/action_audit/factory.rb', line 7

def start
  Thread.current[:action_auditor] = ActionAudit::EventProcessor.new(ActionAudit.store)
end

.with_auditor(params = {}) ⇒ Object



15
16
17
18
19
20
21
# File 'lib/action_audit/factory.rb', line 15

def with_auditor(params = {})
  start
  add_params(params)
  yield
ensure
  flush
end