class Covered::Persist
def apply(record, ignore_mtime: false)
def apply(record, ignore_mtime: false) # The file must still exist: return unless path = expand_path(record[:path]) unless File.exist?(path) Console.logger.debug(self) {"Ignoring coverage, path #{path} does not exist!"} return end # If the file has been modified since... we can't use the coverage. return unless mtime = record[:mtime] unless ignore_mtime if File.mtime(path).to_f > record[:mtime] Console.logger.debug(self) {"Ignoring coverage, path #{path} has been updated: #{File.mtime(path).to_f} > #{record[:mtime]}!"} return end end record[:coverage].each_with_index do |count, index| @output.mark(path, index, count) if count end end