class SimpleCov::ResultAdapter

Responsible for adapting the format of the coverage result whether it's default or with statistics

Attributes

result[R]

Public Class Methods

call(*args) click to toggle source
# File lib/simplecov/result_adapter.rb, line 13
def self.call(*args)
  new(*args).adapt
end
new(result) click to toggle source
# File lib/simplecov/result_adapter.rb, line 9
def initialize(result)
  @result = result
end

Public Instance Methods

adapt() click to toggle source
# File lib/simplecov/result_adapter.rb, line 17
def adapt
  return unless result

  result.each_with_object({}) do |(file_name, cover_statistic), adapted_result|
    if cover_statistic.is_a?(Array)
      adapted_result.merge!(file_name => {"lines" => cover_statistic})
    else
      adapted_result.merge!(file_name => cover_statistic)
    end
  end
end