Class: Evilution::Runner::MutationExecutor::ResultNotifier
- Inherits:
-
Object
- Object
- Evilution::Runner::MutationExecutor::ResultNotifier
- Defined in:
- lib/evilution/runner/mutation_executor/result_notifier.rb
Instance Attribute Summary collapse
-
#survived_count ⇒ Object
readonly
Returns the value of attribute survived_count.
Instance Method Summary collapse
- #finish ⇒ Object
-
#initialize(config, diagnostics:, on_result:) ⇒ ResultNotifier
constructor
A new instance of ResultNotifier.
- #notify(result, index) ⇒ Object
- #start(total) ⇒ Object
Constructor Details
#initialize(config, diagnostics:, on_result:) ⇒ ResultNotifier
Returns a new instance of ResultNotifier.
9 10 11 12 13 14 15 |
# File 'lib/evilution/runner/mutation_executor/result_notifier.rb', line 9 def initialize(config, diagnostics:, on_result:) @config = config @diagnostics = diagnostics @on_result = on_result @survived_count = 0 @progress_bar = nil end |
Instance Attribute Details
#survived_count ⇒ Object (readonly)
Returns the value of attribute survived_count.
17 18 19 |
# File 'lib/evilution/runner/mutation_executor/result_notifier.rb', line 17 def survived_count @survived_count end |
Instance Method Details
#finish ⇒ Object
33 34 35 |
# File 'lib/evilution/runner/mutation_executor/result_notifier.rb', line 33 def finish @progress_bar.finish if @progress_bar end |
#notify(result, index) ⇒ Object
24 25 26 27 28 29 30 31 |
# File 'lib/evilution/runner/mutation_executor/result_notifier.rb', line 24 def notify(result, index) @on_result.call(result) if @on_result @progress_bar.tick(status: result.status) if @progress_bar @diagnostics.log_progress(index, result.status) @diagnostics.log_mutation_diagnostics(result) @survived_count += 1 if result.survived? truncate? ? :truncate : :continue end |
#start(total) ⇒ Object
19 20 21 22 |
# File 'lib/evilution/runner/mutation_executor/result_notifier.rb', line 19 def start(total) @survived_count = 0 @progress_bar = (total) end |