Class: SimpleCov::Formatter::JSONFormatter::SourceFileFormatter

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

Class Method Summary collapse

Class Method Details

.call(source_file, include_source: true, contexts: nil) ⇒ Object



8
9
10
11
12
13
14
15
# File 'lib/simplecov/formatter/json_formatter/source_file_formatter.rb', line 8

def call(source_file, include_source: true, contexts: nil)
  result = include_source ? format_source_code(source_file) : {} #: Hash[Symbol, untyped]
  result.merge!(line_coverage_section(source_file)) if SimpleCov.line_coverage?
  result.merge!(branch_coverage_section(source_file)) if SimpleCov.branch_coverage?
  result.merge!(method_coverage_section(source_file)) if SimpleCov.method_coverage?
  result.merge!(contexts_section(source_file, contexts)) if contexts
  result
end