class Covered::Include

Includes coverage for files matching a glob pattern.

def each(&block)

@parameter coverage [Covered::Coverage] The current coverage object.
@yields {|coverage| ...} Each existing or synthesized coverage object.
Enumerate existing coverage and synthesize empty coverage for unmatched included files.
def each(&block)
	paths = glob
	
	super do |coverage|
		paths.delete(coverage.path)
		
		yield coverage
	end
	
	paths.each do |path|
		yield Coverage.for(path)
	end
end

def glob

@returns [Set(String)] The real paths matched by the include pattern.
Resolve the include pattern to real file paths.
def glob
	paths = Set.new
	root = self.expand_path(@base)
	pattern = File.expand_path(@pattern, root)
	
	Dir.glob(pattern) do |path|
		unless File.directory?(path)
			paths << File.realpath(path)
		end
	end
	
	return paths
end

def initialize(output, pattern, base = "")

@parameter base [String] The base path used to expand the glob.
@parameter pattern [String] The glob pattern to include.
@parameter output [Covered::Base] The output to wrap.
Initialize an include filter for the given glob pattern.
def initialize(output, pattern, base = "")
	super(output)
	
	@pattern = pattern
	@base = base
end