From 85a9fae6716c6cd1b6eeeed1b45a692781ae413e Mon Sep 17 00:00:00 2001 From: hartator Date: Thu, 15 Sep 2016 19:59:42 -0500 Subject: [PATCH] Make instance variable definitions more explicit --- lib/wayback_machine_downloader.rb | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/lib/wayback_machine_downloader.rb b/lib/wayback_machine_downloader.rb index 5220a88..5519d77 100644 --- a/lib/wayback_machine_downloader.rb +++ b/lib/wayback_machine_downloader.rb @@ -138,7 +138,9 @@ class WaybackMachineDownloader end threads = [] - [@threads_count, 1].max.times do + @processed_file_count = 0 + @threads_count = 1 unless @threads_count != 0 + @threads_count.times do threads << Thread.new do until file_queue.empty? file_remote_info = file_queue.pop(true) rescue nil @@ -176,10 +178,7 @@ class WaybackMachineDownloader end end - private - def download_file file_remote_info - @processed_file_count ||= 0 file_url = file_remote_info[:file_url] file_id = file_remote_info[:file_id] file_timestamp = file_remote_info[:timestamp]