Class: EasyDownloader::Result
- Inherits:
-
Object
- Object
- EasyDownloader::Result
- Defined in:
- lib/easy_downloader/result.rb
Instance Attribute Summary collapse
-
#errors ⇒ Object
Returns the value of attribute errors.
-
#files_loaded ⇒ Object
Returns the value of attribute files_loaded.
Instance Method Summary collapse
- #finished ⇒ Object
- #finished_at ⇒ Object
- #finished_path(path) ⇒ Object
- #found(total_found, file_names) ⇒ Object
-
#initialize ⇒ Result
constructor
A new instance of Result.
- #loaded(total = false) ⇒ Object
- #started ⇒ Object
- #started_at ⇒ Object
- #starting_path(path) ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize ⇒ Result
Returns a new instance of Result.
5 6 7 8 9 |
# File 'lib/easy_downloader/result.rb', line 5 def initialize @header, @started, @finished, @errors= '' @files_loaded = [] @progress = ["Progress:"] end |
Instance Attribute Details
#errors ⇒ Object
Returns the value of attribute errors.
3 4 5 |
# File 'lib/easy_downloader/result.rb', line 3 def errors @errors end |
#files_loaded ⇒ Object
Returns the value of attribute files_loaded.
3 4 5 |
# File 'lib/easy_downloader/result.rb', line 3 def files_loaded @files_loaded end |
Instance Method Details
#finished ⇒ Object
33 34 35 |
# File 'lib/easy_downloader/result.rb', line 33 def finished @finished= Time.now end |
#finished_at ⇒ Object
37 |
# File 'lib/easy_downloader/result.rb', line 37 def finished_at; @finished; end |
#finished_path(path) ⇒ Object
54 55 56 |
# File 'lib/easy_downloader/result.rb', line 54 def finished_path(path) @progress << "Finished loading #{path}" end |
#found(total_found, file_names) ⇒ Object
21 22 23 24 25 |
# File 'lib/easy_downloader/result.rb', line 21 def found(total_found, file_names) @found = total_found @header= "We found #{total_found} file(s) to load with the following names: \n" @found_list = file_names end |
#loaded(total = false) ⇒ Object
41 42 43 44 45 46 47 48 |
# File 'lib/easy_downloader/result.rb', line 41 def loaded(total = false) if total @loaded = total @footer= "Loaded #{total} file(s)" else @loaded end end |
#started ⇒ Object
27 28 29 |
# File 'lib/easy_downloader/result.rb', line 27 def started @started= Time.now end |
#started_at ⇒ Object
31 |
# File 'lib/easy_downloader/result.rb', line 31 def started_at; @started; end |
#starting_path(path) ⇒ Object
50 51 52 |
# File 'lib/easy_downloader/result.rb', line 50 def starting_path(path) @progress << "Starting to load #{path}" end |
#to_s ⇒ Object
11 12 13 14 15 16 17 18 19 |
# File 'lib/easy_downloader/result.rb', line 11 def to_s [@header, found_list, started_string, progress, @errors, finished_string, @footer].join("\n") end |