Module: Down::Wget::DownloadedFile

Defined in:
lib/down/wget.rb

Overview

Adds additional attributes to the Tempfile returned in #download.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#headersObject

Returns the value of attribute headers.



232
233
234
# File 'lib/down/wget.rb', line 232

def headers
  @headers
end

#urlObject

Returns the value of attribute url.



232
233
234
# File 'lib/down/wget.rb', line 232

def url
  @url
end

Instance Method Details

#charsetObject



243
244
245
# File 'lib/down/wget.rb', line 243

def charset
  headers["Content-Type"].to_s[/;\s*charset=([^;]+)/i, 1]
end

#content_typeObject



239
240
241
# File 'lib/down/wget.rb', line 239

def content_type
  headers["Content-Type"].to_s.split(";").first
end

#original_filenameObject



234
235
236
237
# File 'lib/down/wget.rb', line 234

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