Module: Down::Wget::DownloadedFile
- Defined in:
- lib/down/wget.rb
Overview
Adds additional attributes to the Tempfile returned in #download.
Instance Attribute Summary collapse
-
#headers ⇒ Object
Returns the value of attribute headers.
-
#url ⇒ Object
Returns the value of attribute url.
Instance Method Summary collapse
Instance Attribute Details
#headers ⇒ Object
Returns the value of attribute headers.
232 233 234 |
# File 'lib/down/wget.rb', line 232 def headers @headers end |
#url ⇒ Object
Returns the value of attribute url.
232 233 234 |
# File 'lib/down/wget.rb', line 232 def url @url end |
Instance Method Details
#charset ⇒ Object
243 244 245 |
# File 'lib/down/wget.rb', line 243 def charset headers["Content-Type"].to_s[/;\s*charset=([^;]+)/i, 1] end |
#content_type ⇒ Object
239 240 241 |
# File 'lib/down/wget.rb', line 239 def content_type headers["Content-Type"].to_s.split(";").first end |
#original_filename ⇒ Object
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 |