lib/generators/rcov.rb in metric_fu-2.0.1 vs lib/generators/rcov.rb in metric_fu-2.1.0
- old
+ new
@@ -1,11 +1,11 @@
require 'enumerator'
module MetricFu
class Rcov < Generator
- NEW_FILE_MARKER = ("=" * 80) + "\n"
+ NEW_FILE_MARKER = /^={80}$/.freeze
class Line
attr_accessor :content, :was_run
def initialize(content, was_run)
@@ -98,14 +98,10 @@
files = {}
output.each_slice(2) {|out| files[out.first.strip] = out.last}
files.each_pair {|fname, content| files[fname] = content.split("\n") }
files.each_pair do |fname, content|
content.map! do |raw_line|
- if raw_line.match(/^!!/)
- line = Line.new(raw_line.gsub('!!', ' '), false).to_h
- else
- line = Line.new(raw_line, true).to_h
- end
+ line = Line.new(raw_line[3..-1], !raw_line.match(/^!!/)).to_h
end
content.reject! {|line| line[:content].blank? }
files[fname] = {:lines => content}
end
files