class Covered::Files

Collects coverage information keyed by source path.

def [](path)

@returns [Covered::Coverage] The coverage object for the path.
@parameter path [String] The source path.
Get or create coverage for the given path.
def [](path)
	@paths[path] ||= Coverage.for(path)
end

def add(coverage)

@parameter coverage [Covered::Coverage] The coverage object to merge.
Merge coverage for the given path into this collection.
def add(coverage)
	self[coverage.path].merge!(coverage)
end

def annotate(path, line_number, value)

@parameter value [String] The annotation text.
@parameter line_number [Integer] The line number to annotate.
@parameter path [String] The source path.
Add an annotation to a line in the given path.
def annotate(path, line_number, value)
	self[path].annotate(line_number, value)
end

def clear

@returns [Hash] The cleared path map.
Remove all tracked coverage data.
def clear
	@paths.clear
end

def each

@returns [Enumerator | Nil] An enumerator without a block.
@parameter coverage [Covered::Coverage] The current coverage object.
@yields {|coverage| ...} Each tracked coverage object.
Enumerate tracked coverage objects.
def each
	return to_enum unless block_given?
	
	@paths.each_value do |coverage|
		yield coverage
	end
end

def empty?

@returns [Boolean] Whether no coverage paths are tracked.
Whether there are no tracked paths.
def empty?
	@paths.empty?
end

def initialize(*)

Initialize an empty coverage collection.
def initialize(*)
	super
	
	@paths = {}
end

def mark(path, line_number, value)

@parameter value [Integer | Array(Integer)] The execution count or counts to add.
@parameter line_number [Integer] The line number to mark.
@parameter path [String] The source path.
Mark a line in the given path as executed.
def mark(path, line_number, value)
	self[path].mark(line_number, value)
end