Class: SimpleCov::Formatter::Base Private

Inherits:
Object
  • Object
show all
Defined in:
lib/simplecov/formatter/base.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Shared scaffolding for formatters that write a coverage report to an output directory and emit a “Coverage report generated for X to Y” summary on stderr (it’s a status message, not data). Subclasses override ‘format` to do their actual writing, and may override `message_prefix` (e.g. JSON prepends “JSON ”).

Direct Known Subclasses

HTMLFormatter, JSONFormatter

Instance Method Summary collapse

Constructor Details

#initialize(silent: false, output_dir: nil) ⇒ Base

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

‘output_dir` defaults to `SimpleCov.coverage_path` so the at_exit pipeline keeps working unchanged. Pass it explicitly to write somewhere else (handy for tests that don’t want to clobber the project’s ‘coverage/` directory).



19
20
21
22
# File 'lib/simplecov/formatter/base.rb', line 19

def initialize(silent: false, output_dir: nil)
  @silent = silent
  @output_dir = output_dir
end