Class: EasyDownloader::AbstractLoader
- Inherits:
-
Object
- Object
- EasyDownloader::AbstractLoader
- Defined in:
- lib/easy_downloader/abstract_loader.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#files ⇒ Object
readonly
Returns the value of attribute files.
-
#result ⇒ Object
readonly
Returns the value of attribute result.
Instance Method Summary collapse
- #execute ⇒ Object
- #execute_load ⇒ Object
-
#initialize(*options) ⇒ AbstractLoader
constructor
A new instance of AbstractLoader.
Methods included from Http
#http_download, #password_option
Methods included from Ftp
#change_remote_dir, #ftp_download, #ftp_password_option, #ftp_upload, #open_ftp, #remote_files_list
Methods included from Sftp
#sftp_download, #sftp_password_option
Constructor Details
#initialize(*options) ⇒ AbstractLoader
Returns a new instance of AbstractLoader.
12 13 14 |
# File 'lib/easy_downloader/abstract_loader.rb', line 12 def initialize(*) @options= Options.new(*) end |
Instance Attribute Details
#files ⇒ Object (readonly)
Returns the value of attribute files.
4 5 6 |
# File 'lib/easy_downloader/abstract_loader.rb', line 4 def files @files end |
#result ⇒ Object (readonly)
Returns the value of attribute result.
4 5 6 |
# File 'lib/easy_downloader/abstract_loader.rb', line 4 def result @result end |
Instance Method Details
#execute ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/easy_downloader/abstract_loader.rb', line 23 def execute begin @options.result.started execute_load @options.result.loaded(@options.load_count) @options.result.finished rescue Exception => e @options.result.errors= (@options, e) end @result = @options.result @files = @result.loaded self end |
#execute_load ⇒ Object
17 18 19 20 21 |
# File 'lib/easy_downloader/abstract_loader.rb', line 17 def execute_load [:ftp, :http, :sftp].include?(@options.type.to_sym) ? send("#{@options.type}_#{self.class.load_type.to_s}".to_sym, @options) : raise(NotImplementedError.new("we don't have an #{@options.type}er of this type.")) end |