123456789_123456789_123456789_123456789_123456789_

Module: SimpleCov::ResultMerger::LegacyFormatAdapter

Relationships & Source Files
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 https://github.com/simplecov-ruby/simplecov/pull/824#issuecomment-576049747

Class Method Summary

Class Method Details

.call(result) (mod_func)

[ GitHub ]

  
# 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 (mod_func)

Pre-0.18 coverage data pointed from file directly to an array of line coverage rather than a {"lines" => [...]} hash.

[ GitHub ]

  
# 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) (mod_func)

[ GitHub ]

  
# 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