lib/simplecov-lcov.rb in simplecov-lcov-0.2.0 vs lib/simplecov-lcov.rb in simplecov-lcov-0.2.1
- old
+ new
@@ -66,16 +66,24 @@
filename.gsub("#{SimpleCov.root}/", '').gsub('/', '-')
.tap { |name| name << '.lcov' }
end
def format_file(file)
- "SF:#{file.filename}\n".tap do |content|
- file.lines.reject(&:never?).reject(&:skipped?)
- .each do |line|
- content << "DA:#{line.number},#{line.coverage}\n"
- end
- content << "end_of_record\n"
- end
+ "SF:#{file.filename}\n#{format_lines(file)}\nend_of_record\n"
+ end
+
+ def format_lines(file)
+ filtered_lines(file)
+ .map { |line| format_line(line) }
+ .join("\n")
+ end
+
+ def filtered_lines(file)
+ file.lines.reject(&:never?).reject(&:skipped?)
+ end
+
+ def format_line(line)
+ "DA:#{line.number},#{line.coverage}"
end
end
end
end