Module: SimpleCov::ResultMerger::LegacyFormatAdapter

Defined in:
lib/simplecov/result_merger/legacy_format_adapter.rb

Overview

We changed the format of the raw result data in simplecov, as people are likely to have “old” resultsets lying around (but not too old so that they’re still considered we can adapt them). See github.com/simplecov-ruby/simplecov/pull/824#issuecomment-576049747

Class Method Summary collapse

Class Method Details

.call(result) ⇒ Object



12
13
14
# File 'lib/simplecov/result_merger/legacy_format_adapter.rb', line 12

def call(result)
  pre_0_18?(result) ? upgrade(result) : result
end

.pre_0_18?(result) ⇒ Boolean

Pre-0.18 coverage data pointed from file directly to an array of line coverage rather than a ‘=> […]` hash.

Returns:

  • (Boolean)


18
19
20
21
# File 'lib/simplecov/result_merger/legacy_format_adapter.rb', line 18

def pre_0_18?(result)
  _key, data = result.first
  data.is_a?(Array)
end

.upgrade(result) ⇒ Object



23
24
25
# File 'lib/simplecov/result_merger/legacy_format_adapter.rb', line 23

def upgrade(result)
  result.transform_values { |line_coverage_data| {"lines" => line_coverage_data} }
end