Class: SimpleCov::Formatter::JSONFormatter::SourceFileFormatter
- Inherits:
-
Object
- Object
- SimpleCov::Formatter::JSONFormatter::SourceFileFormatter
- Defined in:
- lib/simplecov/formatter/json_formatter/source_file_formatter.rb
Overview
Renders a single ‘SimpleCov::SourceFile` as the per-file payload in coverage.json: source code plus per-enabled-criterion arrays and totals.
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(source_file, include_source: true) ⇒ SourceFileFormatter
constructor
A new instance of SourceFileFormatter.
Constructor Details
#initialize(source_file, include_source: true) ⇒ SourceFileFormatter
Returns a new instance of SourceFileFormatter.
10 11 12 13 |
# File 'lib/simplecov/formatter/json_formatter/source_file_formatter.rb', line 10 def initialize(source_file, include_source: true) @source_file = source_file @include_source = include_source end |
Instance Method Details
#call ⇒ Object
15 16 17 18 19 20 21 |
# File 'lib/simplecov/formatter/json_formatter/source_file_formatter.rb', line 15 def call result = @include_source ? format_source_code : {} result.merge!(line_coverage_section) if line_coverage_enabled? result.merge!(branch_coverage_section) if SimpleCov.branch_coverage? result.merge!(method_coverage_section) if SimpleCov.method_coverage? result end |