Class: Undercover::LcovParser

Inherits:
Object
  • Object
show all
Defined in:
lib/undercover/lcov_parser.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(lcov_io) ⇒ LcovParser

Returns a new instance of LcovParser.



9
10
11
12
# File 'lib/undercover/lcov_parser.rb', line 9

def initialize(lcov_io)
  @io = lcov_io
  @source_files = {}
end

Instance Attribute Details

#ioObject (readonly)

Returns the value of attribute io.



7
8
9
# File 'lib/undercover/lcov_parser.rb', line 7

def io
  @io
end

#source_filesObject (readonly)

Returns the value of attribute source_files.



7
8
9
# File 'lib/undercover/lcov_parser.rb', line 7

def source_files
  @source_files
end

Class Method Details

.parse(lcov_report_path) ⇒ Object



14
15
16
17
# File 'lib/undercover/lcov_parser.rb', line 14

def self.parse(lcov_report_path)
  lcov_io = File.open(lcov_report_path)
  new(lcov_io).parse
end

Instance Method Details

#parseObject



19
20
21
22
23
# File 'lib/undercover/lcov_parser.rb', line 19

def parse
  io.each(&method(:parse_line))
  io.close
  self
end