Class: Mongrel::Camping::CampingHandler
- Inherits:
-
HttpHandler
- Object
- HttpHandler
- Mongrel::Camping::CampingHandler
- Defined in:
- lib/mongrel/camping.rb
Overview
This is a specialized handler for Camping applications that has them process the request and then translates the results into something the Mongrel::HttpResponse needs.
Instance Method Summary collapse
-
#initialize(klass) ⇒ CampingHandler
constructor
A new instance of CampingHandler.
- #process(request, response) ⇒ Object
Constructor Details
#initialize(klass) ⇒ CampingHandler
Returns a new instance of CampingHandler.
30 31 32 |
# File 'lib/mongrel/camping.rb', line 30 def initialize(klass) @klass = klass end |
Instance Method Details
#process(request, response) ⇒ Object
34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/mongrel/camping.rb', line 34 def process(request, response) req = StringIO.new(request.body) controller = @klass.run(req, request.params) response.start(controller.status) do |head,out| controller.headers.each do |k, v| [*v].each do |vi| head[k] = vi end end out << controller.body end end |