Class: Uniword::Batch::Operation::Runner
- Inherits:
-
Object
- Object
- Uniword::Batch::Operation::Runner
- Defined in:
- lib/uniword/batch/operation/runner.rb
Overview
Parallel runner for a Task across many files.
Instance Method Summary collapse
-
#initialize(task:, paths:) ⇒ Runner
constructor
A new instance of Runner.
-
#run ⇒ Report
Run the task on every path.
Constructor Details
#initialize(task:, paths:) ⇒ Runner
Returns a new instance of Runner.
11 12 13 14 |
# File 'lib/uniword/batch/operation/runner.rb', line 11 def initialize(task:, paths:) @task = task @paths = paths end |
Instance Method Details
#run ⇒ Report
Run the task on every path. Files are processed serially in v1 (parallelism deferred — see TODO.tier-2/10).
20 21 22 23 24 25 26 |
# File 'lib/uniword/batch/operation/runner.rb', line 20 def run report = Report.new(operation_name: @task.name) @paths.each do |path| report.add(@task.run(path)) end report end |