Class: LogWeasel::Middleware
- Inherits:
-
Object
- Object
- LogWeasel::Middleware
- Defined in:
- lib/log_weasel/middleware.rb
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app, options = {}) ⇒ Middleware
constructor
A new instance of Middleware.
Constructor Details
#initialize(app, options = {}) ⇒ Middleware
Returns a new instance of Middleware.
2 3 4 5 |
# File 'lib/log_weasel/middleware.rb', line 2 def initialize(app, = {}) @app = app @key = LogWeasel.config.key ? "#{LogWeasel.config.key}-WEB" : "WEB" end |
Instance Method Details
#call(env) ⇒ Object
7 8 9 10 11 12 |
# File 'lib/log_weasel/middleware.rb', line 7 def call(env) LogWeasel::Transaction.create @key @app.call(env) ensure LogWeasel::Transaction.destroy end |