Class: PostHog::Rails::RequestContext Private
- Inherits:
-
Object
- Object
- PostHog::Rails::RequestContext
- Defined in:
- lib/posthog/rails/request_context.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Rack middleware that creates a request-local PostHog context from tracing headers.
Instance Method Summary collapse
-
#call(env) ⇒ Array
private
Rack response.
-
#initialize(app) ⇒ RequestContext
constructor
private
A new instance of RequestContext.
Constructor Details
#initialize(app) ⇒ RequestContext
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of RequestContext.
14 15 16 |
# File 'lib/posthog/rails/request_context.rb', line 14 def initialize(app) @app = app end |
Instance Method Details
#call(env) ⇒ Array
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns Rack response.
20 21 22 23 24 25 26 |
# File 'lib/posthog/rails/request_context.rb', line 20 def call(env) request = build_request(env) Internal::Context.with_context(context_data(request), fresh: true) do @app.call(env) end end |