CoveredSourceCoveredWrapper

class Wrapper

Wraps another coverage output.

Definitions

def initialize(output = Base.new)

Initialize the wrapper with the given output.

Signature

parameter output Covered::Base

The output to wrap.

Implementation

def initialize(output = Base.new)
	@output = output
end

attr :output

Signature

attribute Covered::Base

The wrapped output.

def start

Start tracking coverage on the wrapped output.

Implementation

def start
	@output.start
end

def clear

Clear coverage on the wrapped output.

Implementation

def clear
	@output.clear
end

def finish

Finish tracking coverage on the wrapped output.

Implementation

def finish
	@output.finish
end

def accept?(path)

Whether the wrapped output accepts the given path.

Signature

parameter path String

The source path.

returns Boolean

Whether the wrapped output accepts the path.

Implementation

def accept?(path)
	@output.accept?(path)
end

def mark(path, lineno, value)

Mark coverage on the wrapped output.

Signature

parameter path String

The source path.

parameter lineno Integer

The starting line number.

parameter value Integer | Array(Integer)

The execution count or counts to add.

Implementation

def mark(path, lineno, value)
	@output.mark(path, lineno, value)
end

def add(coverage)

Add coverage to the wrapped output.

Signature

parameter coverage Covered::Coverage

The coverage object to add.

Implementation

def add(coverage)
	@output.add(coverage)
end

def each(&block)

Implementation

def each(&block)
	@output.each(&block)
end

def relative_path(path)

Convert a path using the wrapped output.

Signature

parameter path String

The source path.

returns String

The converted path.

Implementation

def relative_path(path)
	@output.relative_path(path)
end

def expand_path(path)

Expand a path using the wrapped output.

Signature

parameter path String

The path to expand.

returns String

The expanded path.

Implementation

def expand_path(path)
	@output.expand_path(path)
end

def to_h

Convert all coverage data to a hash keyed by path.

Signature

returns Hash(String, Covered::Coverage)

Coverage keyed by path.

Implementation

def to_h
	to_enum(:each).collect{|coverage| [coverage.path, coverage]}.to_h
end