Class: ImgFetcher::Main
- Inherits:
-
Object
- Object
- ImgFetcher::Main
- Defined in:
- lib/img_fetcher/main.rb
Instance Method Summary collapse
-
#initialize(arguments) ⇒ Main
constructor
A new instance of Main.
- #run ⇒ Object
Constructor Details
Instance Method Details
#run ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/img_fetcher/main.rb', line 10 def run start_stats File.open(@arguments[:file_path], 'r').each_with_index do |line, index| if @arguments[:threaded] @threads << Thread.new { manage_line(line, index + 1) } else manage_line(line, index + 1) end end @threads.each(&:join) if @arguments[:threaded] end_stats end |