14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
# File 'lib/cover_me/results.rb', line 14
def merge_results!(cov_results, path = CoverMe.config.results.store)
data = CoverMe::Results.read_results(path)
cov_results.each do |file, results|
if data.has_key?(file)
results.each_with_index do |result, i|
summed_value = result if result.nil?
summed_value = data[file][i]
elsif !data[file][i].nil?
summed_value = data[file][i] + result
end
data[file][i] = summed_value
end
else
data[file] = results
end
end
File.open(path, 'w') do |f|
f.write(data.inspect)
end
return data
end
|