Class: Rack::WebProfiler::Engine
- Inherits:
-
Object
- Object
- Rack::WebProfiler::Engine
- Defined in:
- lib/rack/web_profiler/engine.rb
Defined Under Namespace
Classes: Processor
Class Method Summary collapse
-
.process(request, body, status, headers) ⇒ Rack::WebProfiler::Response, Rack::Response
Process request.
-
.process_exception(request) ⇒ Rack::Response
Process an exception.
Class Method Details
.process(request, body, status, headers) ⇒ Rack::WebProfiler::Response, Rack::Response
Process request.
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/rack/web_profiler/engine.rb', line 13 def process(request, body, status, headers) response = Rack::WebProfiler::Response.new(request, body, status, headers) record = collect!(request, response) @token = record.token @url = WebProfiler::Router.(record.token) response.header["X-RackWebProfiler-Token"] = @token response.header["X-RackWebProfiler-Url"] = WebProfiler::Router.url_for_profiler(record.token) return response if !headers[CONTENT_TYPE].nil? and !headers[CONTENT_TYPE].include? "text/html" response = Rack::Response.new([], status, response.headers) if body.respond_to?(:each) body.each { |fragment| response.write inject(fragment) } elsif body.is_a? String response.write inject(body) end response end |
.process_exception(request) ⇒ Rack::Response
Process an exception.
41 42 43 |
# File 'lib/rack/web_profiler/engine.rb', line 41 def process_exception(request) process(request, [], 500, {}) end |