Class: Timber::Integrations::Rack::SessionContext
- Inherits:
-
Object
- Object
- Timber::Integrations::Rack::SessionContext
- Defined in:
- lib/timber/integrations/rack/session_context.rb
Overview
Reponsible for adding the Session context for applications that use ‘Rack`.
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app) ⇒ SessionContext
constructor
A new instance of SessionContext.
Constructor Details
#initialize(app) ⇒ SessionContext
Returns a new instance of SessionContext.
6 7 8 |
# File 'lib/timber/integrations/rack/session_context.rb', line 6 def initialize(app) @app = app end |
Instance Method Details
#call(env) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/timber/integrations/rack/session_context.rb', line 10 def call(env) id = get_session_id(env) if id context = Contexts::Session.new(id: get_session_id(env)) CurrentContext.with(context) do @app.call(env) end else @app.call(env) end end |