Class: StudFinder::Coverage::Lcov

Inherits:
Object
  • Object
show all
Defined in:
lib/stud_finder/coverage/lcov.rb

Defined Under Namespace

Classes: Error

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(path:, files:, project_root: nil) ⇒ Lcov

Returns a new instance of Lcov.



12
13
14
15
16
17
18
# File 'lib/stud_finder/coverage/lcov.rb', line 12

def initialize(path:, files:, project_root: nil)
  @path = path
  @files = files
  @file_set = Set.new(files)
  @project_root = File.expand_path(project_root) if project_root
  @missing_files = []
end

Instance Attribute Details

#missing_filesObject (readonly)

Returns the value of attribute missing_files.



10
11
12
# File 'lib/stud_finder/coverage/lcov.rb', line 10

def missing_files
  @missing_files
end

Instance Method Details

#callObject



20
21
22
23
24
# File 'lib/stud_finder/coverage/lcov.rb', line 20

def call
  reported = parse_report
  @missing_files = @files.reject { |file| reported.key?(file) }
  @files.to_h { |file| [file, reported.fetch(file, 0.0)] }
end