Class: Ixtlan::AuditRack

Inherits:
Object
  • Object
show all
Defined in:
lib/ixtlan/audit_rack.rb

Constant Summary collapse

AUDIT =
Ixtlan::Models::AUDIT.nil? ? nil : Object.full_const_get(Ixtlan::Models::AUDIT)

Instance Method Summary collapse

Constructor Details

#initialize(app) ⇒ AuditRack

Returns a new instance of AuditRack.



5
6
7
# File 'lib/ixtlan/audit_rack.rb', line 5

def initialize(app)
  @app = app
end

Instance Method Details

#call(env) ⇒ Object



9
10
11
12
13
14
15
16
17
# File 'lib/ixtlan/audit_rack.rb', line 9

def call(env)
  result = @app.call(env)
  if AUDIT
    AUDIT.pop_all.each do |audit|
      audit.save
    end
  end
  result
end