Class: Reviewer::Batch
- Inherits:
-
Object
- Object
- Reviewer::Batch
- Defined in:
- lib/reviewer/batch.rb,
lib/reviewer/batch/formatter.rb
Overview
Provides a structure for running commands for a given set of tools
Defined Under Namespace
Classes: Formatter, UnrecognizedCommandError
Instance Attribute Summary collapse
-
#command_type ⇒ Object
readonly
Returns the value of attribute command_type.
-
#report ⇒ Object
readonly
Returns the value of attribute report.
-
#tools ⇒ Object
readonly
Returns the value of attribute tools.
Instance Method Summary collapse
-
#initialize(command_type, tools, strategy:, context:) ⇒ self
constructor
Generates an instance of Batch for running multiple tools together.
-
#run ⇒ Report
Iterates over the tools in the batch to successfully run the commands.
Constructor Details
#initialize(command_type, tools, strategy:, context:) ⇒ self
Generates an instance of Batch for running multiple tools together
21 22 23 24 25 26 27 |
# File 'lib/reviewer/batch.rb', line 21 def initialize(command_type, tools, strategy:, context:) @command_type = command_type @tools = tools @strategy = strategy @context = context @report = Report.new end |
Instance Attribute Details
#command_type ⇒ Object (readonly)
Returns the value of attribute command_type.
11 12 13 |
# File 'lib/reviewer/batch.rb', line 11 def command_type @command_type end |
#report ⇒ Object (readonly)
Returns the value of attribute report.
11 12 13 |
# File 'lib/reviewer/batch.rb', line 11 def report @report end |
#tools ⇒ Object (readonly)
Returns the value of attribute tools.
11 12 13 |
# File 'lib/reviewer/batch.rb', line 11 def tools @tools end |
Instance Method Details
#run ⇒ Report
Iterates over the tools in the batch to successfully run the commands. Also times the entire
batch in order to provide a total execution time.
33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/reviewer/batch.rb', line 33 def run elapsed_time = Benchmark.realtime do clear_last_statuses matching_tools.each do |tool| runner = run_tool(tool) break unless runner.success? || runner.missing? end end @report.record_duration(elapsed_time) @report end |