Module: Down::Wget::DownloadedFile

Defined in:
lib/down/wget.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#headersObject

Returns the value of attribute headers.



209
210
211
# File 'lib/down/wget.rb', line 209

def headers
  @headers
end

#urlObject

Returns the value of attribute url.



209
210
211
# File 'lib/down/wget.rb', line 209

def url
  @url
end

Instance Method Details

#charsetObject



220
221
222
# File 'lib/down/wget.rb', line 220

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

#content_typeObject



216
217
218
# File 'lib/down/wget.rb', line 216

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

#original_filenameObject



211
212
213
214
# File 'lib/down/wget.rb', line 211

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