class Hatchet::Middleware

Public: Middleware for making sure the nested diagnostic context is cleared between requests.

Public Class Methods

new(app) click to toggle source

Public: Creates a new instance of the middleware, wrapping the given application.

app - The application to wrap.

# File lib/hatchet/middleware.rb, line 14
def initialize(app)
  @app = app
end

Public Instance Methods

call(env) click to toggle source

Public: Calls the wrapped application with the given environment, ensuring the nested diagnostic context is cleared afterwards.

env - The enviroment Hash for the request.

Returns the status, headers, body Array returned by the wrapped application.

# File lib/hatchet/middleware.rb, line 26
def call(env)
  @app.call(env)
ensure
  log.ndc.clear!
end