Class: Verity::Reporters::CompositeReporter
- Inherits:
-
Object
- Object
- Verity::Reporters::CompositeReporter
- Includes:
- Verity::Reporter
- Defined in:
- lib/verity/reporters/composite_reporter.rb
Overview
Public: Multiplexer that forwards every Reporter callback to multiple child reporters. Useful when you need both console output and machine-readable logging from the same run.
Examples
Verity.configure do |c|
c.reporter = Verity::Reporters::CompositeReporter.new(
Verity::Reporters::DotsReporter.new($stdout),
Verity::Reporters::TestReporter.new
)
end
Instance Method Summary collapse
-
#initialize(*reporters) ⇒ CompositeReporter
constructor
Public: Create a new CompositeReporter wrapping one or more reporters.
- #on_parallel_complete(counts:, problem_rows:) ⇒ Object
- #on_run_finish(summary:, worker_id:) ⇒ Object
- #on_run_start(total:, worker_id:) ⇒ Object
- #on_test_complete(result:, worker_id:) ⇒ Object
Constructor Details
#initialize(*reporters) ⇒ CompositeReporter
Public: Create a new CompositeReporter wrapping one or more reporters.
reporters - One or more objects implementing Verity::Reporter.
23 24 25 |
# File 'lib/verity/reporters/composite_reporter.rb', line 23 def initialize(*reporters) @reporters = reporters end |
Instance Method Details
#on_parallel_complete(counts:, problem_rows:) ⇒ Object
39 40 41 |
# File 'lib/verity/reporters/composite_reporter.rb', line 39 def on_parallel_complete(counts:, problem_rows:) @reporters.each { _1.on_parallel_complete(counts:, problem_rows:) } end |
#on_run_finish(summary:, worker_id:) ⇒ Object
35 36 37 |
# File 'lib/verity/reporters/composite_reporter.rb', line 35 def on_run_finish(summary:, worker_id:) @reporters.each { _1.on_run_finish(summary:, worker_id:) } end |
#on_run_start(total:, worker_id:) ⇒ Object
27 28 29 |
# File 'lib/verity/reporters/composite_reporter.rb', line 27 def on_run_start(total:, worker_id:) @reporters.each { _1.on_run_start(total:, worker_id:) } end |
#on_test_complete(result:, worker_id:) ⇒ Object
31 32 33 |
# File 'lib/verity/reporters/composite_reporter.rb', line 31 def on_test_complete(result:, worker_id:) @reporters.each { _1.on_test_complete(result:, worker_id:) } end |