Class: ActiveContext::Rack
- Inherits:
-
Object
- Object
- ActiveContext::Rack
- Defined in:
- lib/activecontext/rack.rb
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app, &block) ⇒ Rack
constructor
A new instance of Rack.
Constructor Details
#initialize(app, &block) ⇒ Rack
Returns a new instance of Rack.
6 7 8 9 |
# File 'lib/activecontext/rack.rb', line 6 def initialize(app, &block) @app = app @block = block end |
Instance Method Details
#call(env) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/activecontext/rack.rb', line 11 def call(env) req = ::Rack::Request.new(env) container = Container.new container.register :request, {} container.register :session, req.session container.instance_exec(req, &@block) if @block container.run do @app.call(env) end end |