Module: Down::Http::DownloadedFile

Defined in:
lib/down/http.rb

Overview

Defines some additional attributes for the returned Tempfile.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#headersObject

Returns the value of attribute headers.



143
144
145
# File 'lib/down/http.rb', line 143

def headers
  @headers
end

#urlObject

Returns the value of attribute url.



143
144
145
# File 'lib/down/http.rb', line 143

def url
  @url
end

Instance Method Details

#charsetObject



154
155
156
# File 'lib/down/http.rb', line 154

def charset
  HTTP::ContentType.parse(headers["Content-Type"]).charset
end

#content_typeObject



150
151
152
# File 'lib/down/http.rb', line 150

def content_type
  HTTP::ContentType.parse(headers["Content-Type"]).mime_type
end

#original_filenameObject



145
146
147
148
# File 'lib/down/http.rb', line 145

def original_filename
  Utils.filename_from_content_disposition(headers["Content-Disposition"]) ||
  Utils.filename_from_path(HTTP::URI.parse(url).path)
end