Class Rack::Utils::Context
In: lib/rack/utils.rb
Parent: Object

Context allows the use of a compatible middleware at different points in a request handling stack. A compatible middleware must define context which should take the arguments env and app. The first of which would be the request environment. The second of which would be the rack application that the request would be forwarded to.

Methods

call   context   new   recontext  

Attributes

app  [R] 
for  [R] 

Public Class methods

[Source]

     # File lib/rack/utils.rb, line 168
168:       def initialize(app_f, app_r)
169:         raise 'running context does not respond to #context' unless app_f.respond_to? :context
170:         @for, @app = app_f, app_r
171:       end

Public Instance methods

[Source]

     # File lib/rack/utils.rb, line 173
173:       def call(env)
174:         @for.context(env, @app)
175:       end

[Source]

     # File lib/rack/utils.rb, line 181
181:       def context(env, app=@app)
182:         recontext(app).call(env)
183:       end

[Source]

     # File lib/rack/utils.rb, line 177
177:       def recontext(app)
178:         self.class.new(@for, app)
179:       end

[Validate]