Module: Rack::Middleware

Defined in:
lib/rack/middleware.rb

Instance Method Summary collapse

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_hashObject



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

#requestObject



22
23
24
# File 'lib/rack/middleware.rb', line 22

def request
  @request ||= Request.new @env
end

#responseObject



26
27
28
# File 'lib/rack/middleware.rb', line 26

def response
  @response ||= Response.new @body, @status, @header
end