Class: FileActioner
- Inherits:
-
Object
- Object
- FileActioner
- Defined in:
- lib/file_actioner.rb
Instance Method Summary collapse
-
#initialize(file_finder, task_manager) ⇒ FileActioner
constructor
A new instance of FileActioner.
- #run ⇒ Object
Constructor Details
#initialize(file_finder, task_manager) ⇒ FileActioner
Returns a new instance of FileActioner.
3 4 5 6 7 8 |
# File 'lib/file_actioner.rb', line 3 def initialize(file_finder, task_manager) @file_finder = file_finder @task_manager = task_manager @prev_all_files = [] end |
Instance Method Details
#run ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/file_actioner.rb', line 10 def run begin num_tasks_run = 0 files = @file_finder.find # Refactor this to the file_finder class changes = (files[:all] - @prev_all_files) | (@prev_all_files - files[:all]) files[:filtered] = files[:filtered] | changes if (files[:filtered] != []) num_tasks_run = @task_manager.run(files) end @prev_all_files = files[:all] rescue Exception => e @task_manager.output_exception(e); end num_tasks_run > 0 end |