Class: SimpleCovJSONFormatter::SourceFileFormatter

Inherits:
Object
  • Object
show all
Defined in:
lib/simplecov_json_formatter/source_file_formatter.rb

Instance Method Summary collapse

Constructor Details

#initialize(source_file) ⇒ SourceFileFormatter

Returns a new instance of SourceFileFormatter.



5
6
7
8
# File 'lib/simplecov_json_formatter/source_file_formatter.rb', line 5

def initialize(source_file)
  @source_file = source_file
  @line_coverage = nil
end

Instance Method Details

#formatObject



10
11
12
13
14
15
16
# File 'lib/simplecov_json_formatter/source_file_formatter.rb', line 10

def format
  if SimpleCov.branch_coverage?
    line_coverage.merge(branch_coverage)
  else
    line_coverage
  end
end