Class: Falkor::Download
- Inherits:
-
Object
- Object
- Falkor::Download
- Includes:
- TrackableProgress
- Defined in:
- lib/falkor/download.rb
Instance Method Summary collapse
- #download ⇒ Object
-
#initialize(url, file_name) ⇒ Download
constructor
A new instance of Download.
Methods included from TrackableProgress
Constructor Details
#initialize(url, file_name) ⇒ Download
9 10 11 12 |
# File 'lib/falkor/download.rb', line 9 def initialize(url, file_name) @url = url @file_name = file_name end |
Instance Method Details
#download ⇒ Object
14 15 16 17 18 19 20 21 22 23 |
# File 'lib/falkor/download.rb', line 14 def download return destination if File.exist?(destination) request do |response, file_size| next unless success?(response) report_progress(:write_chunks, file_size, response, &Proc.new) destination end end |