Class: Uniword::Batch::Operation::Runner

Inherits:
Object
  • Object
show all
Defined in:
lib/uniword/batch/operation/runner.rb

Overview

Parallel runner for a Task across many files.

Instance Method Summary collapse

Constructor Details

#initialize(task:, paths:) ⇒ Runner

Returns a new instance of Runner.

Parameters:

  • task (Task)
  • paths (Array<String>)


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

#runReport

Run the task on every path. Files are processed serially in v1 (parallelism deferred — see TODO.tier-2/10).

Returns:



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