Module: Rack::Middleware
- Defined in:
- lib/rack/middleware.rb
Instance Method Summary collapse
- #call(env) ⇒ Object
- #header_hash ⇒ Object
- #initialize(app, *a, &b) ⇒ Object
- #request ⇒ Object
- #response ⇒ Object
Instance Method Details
#call(env) ⇒ Object
8 9 10 11 12 13 14 15 |
# File 'lib/rack/middleware.rb', line 8 def call env @env = env before if respond_to? :before @status, @header, @body = @app.call @env after if respond_to? :after @status, @header, @body = @response.finish if @response [@status, @header, @body] end |
#header_hash ⇒ Object
18 19 20 |
# File 'lib/rack/middleware.rb', line 18 def header_hash @header_hash ||= (@header = Utils::HeaderHash.new @header) end |
#initialize(app, *a, &b) ⇒ Object
3 4 5 6 |
# File 'lib/rack/middleware.rb', line 3 def initialize app, *a, &b @app = app args *a, &b if respond_to? :args end |
#request ⇒ Object
22 23 24 |
# File 'lib/rack/middleware.rb', line 22 def request @request ||= Request.new @env end |
#response ⇒ Object
26 27 28 |
# File 'lib/rack/middleware.rb', line 26 def response @response ||= Response.new @body, @status, @header end |