Module: Scales::Worker::Response
- Defined in:
- lib/scales-worker/response.rb
Class Method Summary collapse
Class Method Details
.to_job(id, response) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/scales-worker/response.rb', line 6 def to_job(id, response) status, headers, chunked_body = response headers = headers.dup.keep_if do |key, value| key.match /^HTTP_/ or [ 'Location', 'Content-Type', 'Set-Cookie', 'REQUEST_METHOD', 'SCRIPT_NAME', 'PATH_INFO', 'QUERY_STRING', 'SERVER_NAME', 'SERVER_PORT' ].include?(key) end headers['scales.id'] = id body = "" chunked_body.each{ |chunk| body << chunk } [status, headers, body] end |
.to_string(response) ⇒ Object
31 32 33 34 35 |
# File 'lib/scales-worker/response.rb', line 31 def to_string(response) body = "" response.last.each{ |chunk| body << chunk } body end |