Class: Rack::Adapter::Camping

Inherits:
Object
  • Object
show all
Defined in:
lib/gems/rack-0.9.1/lib/rack/adapter/camping.rb

Instance Method Summary collapse

Constructor Details

#initialize(app) ⇒ Camping

Returns a new instance of Camping.



4
5
6
# File 'lib/gems/rack-0.9.1/lib/rack/adapter/camping.rb', line 4

def initialize(app)
  @app = app
end

Instance Method Details

#call(env) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/gems/rack-0.9.1/lib/rack/adapter/camping.rb', line 8

def call(env)
  env["PATH_INFO"] ||= ""
  env["SCRIPT_NAME"] ||= ""
  controller = @app.run(env['rack.input'], env)
  h = controller.headers
  h.each_pair do |k,v|
    if v.kind_of? URI
      h[k] = v.to_s
    end
  end
  [controller.status, controller.headers, [controller.body.to_s]]
end