class BreezyPDFLite::Response

RenderRequest -> Net::HTTPResponse wrapper that is streaming compatable

Public Class Methods

new(response) click to toggle source
# File lib/breezy_pdf_lite/response.rb, line 6
def initialize(response)
  @response = response
end

Public Instance Methods

body() click to toggle source
# File lib/breezy_pdf_lite/response.rb, line 26
def body
  io = StringIO.new
  io.binmode

  each do |chunk|
    io.write chunk
  end

  io.flush
  io.rewind

  io
end
each(&blk) click to toggle source
# File lib/breezy_pdf_lite/response.rb, line 22
def each(&blk)
  @response.read_body(&blk)
end
headers() click to toggle source
# File lib/breezy_pdf_lite/response.rb, line 14
def headers
  {
    "Content-Type" => "application/pdf",
    "Content-Length" => @response.header["Content-Length"],
    "Content-Disposition" => @response.header["Content-Disposition"]
  }
end
status() click to toggle source
# File lib/breezy_pdf_lite/response.rb, line 10
def status
  @status ||= @response.code.to_i
end