Class: SimpleCov::ResultAdapter

Inherits:
Object
  • Object
show all
Defined in:
lib/simplecov/result_adapter.rb

Overview

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(result) ⇒ ResultAdapter

Returns a new instance of ResultAdapter.



10
11
12
# File 'lib/simplecov/result_adapter.rb', line 10

def initialize(result)
  @result = result
end

Instance Attribute Details

#resultObject (readonly)

Returns the value of attribute result.



8
9
10
# File 'lib/simplecov/result_adapter.rb', line 8

def result
  @result
end

Class Method Details

.call(*args) ⇒ Object



14
15
16
# File 'lib/simplecov/result_adapter.rb', line 14

def self.call(*args)
  new(*args).adapt
end

Instance Method Details

#adaptObject



18
19
20
21
22
23
24
# File 'lib/simplecov/result_adapter.rb', line 18

def adapt
  return unless result

  result.to_h do |file_name, cover_statistic|
    [file_name, adapt_one(file_name, cover_statistic)]
  end
end