| Class | Rack::Utils::Context |
| In: |
lib/rack/utils.rb
|
| Parent: | Proc |
The recommended manner in which to implement a contexting application is to define a method context in which a new Context is instantiated.
As a Context is a glorified block, it is highly recommended that you define the contextual block within the application‘s operational scope. This would typically the application as you‘re place into Rack‘s stack.
class MyObject
...
def context app
Rack::Utils::Context.new app do |env|
do_stuff
response = app.call(env)
do_more_stuff
end
end
...
end
mobj = MyObject.new app = mobj.context other_app Rack::Handler::Mongrel.new app
| inspect | -> | old_inspect |
| app | [R] | |
| for | [R] |