Class: FtpMultipartDownload::Downloader
- Inherits:
-
Object
- Object
- FtpMultipartDownload::Downloader
- Defined in:
- lib/ftp_multipart_download/downloader.rb
Instance Attribute Summary collapse
-
#argv ⇒ Object
readonly
Returns the value of attribute argv.
Instance Method Summary collapse
-
#download(concurrent, remotefile, localfile = File.basename(remotefile), blocksize = DEFAULT_BLOCKSIZE) ⇒ Object
concurrent multipart downloading.
-
#initialize(host = nil, user_or_options = {}, passwd = nil, acct = nil) ⇒ Downloader
constructor
see Net::FTP#initialize.
Constructor Details
#initialize(host = nil, user_or_options = {}, passwd = nil, acct = nil) ⇒ Downloader
see Net::FTP#initialize
12 13 14 |
# File 'lib/ftp_multipart_download/downloader.rb', line 12 def initialize(host = nil, = {}, passwd = nil, acct = nil) @argv = [host, , passwd, acct] end |
Instance Attribute Details
#argv ⇒ Object (readonly)
Returns the value of attribute argv.
3 4 5 |
# File 'lib/ftp_multipart_download/downloader.rb', line 3 def argv @argv end |
Instance Method Details
#download(concurrent, remotefile, localfile = File.basename(remotefile), blocksize = DEFAULT_BLOCKSIZE) ⇒ Object
concurrent multipart downloading.
24 25 26 27 28 29 30 31 |
# File 'lib/ftp_multipart_download/downloader.rb', line 24 def download(concurrent, remotefile, localfile = File.basename(remotefile), blocksize = DEFAULT_BLOCKSIZE) connection_pool = ConnectionPool.new(concurrent, *argv) if connection_pool.count == 0 raise ConnectionError.new('Could not establish any connection.', errors: connection_pool.errors) end Scheduler.new(connection_pool).schedule(remotefile, localfile, blocksize) end |