Class: Covered::Filter

Inherits:
Wrapper show all
Defined in:
lib/covered/wrapper.rb

Overview

Filters coverage before forwarding it to another output.

Direct Known Subclasses

Only, Root, Skip

Instance Attribute Summary

Attributes inherited from Wrapper

#The wrapped output., #output

Instance Method Summary collapse

Methods inherited from Wrapper

#add, #clear, #expand_path, #finish, #initialize, #relative_path, #start, #to_h

Methods inherited from Base

#add, #clear, #expand_path, #finish, #relative_path, #start

Constructor Details

This class inherits a constructor from Covered::Wrapper

Instance Method Details

#accept?(path) ⇒ Boolean

Whether the given path is accepted by this filter and its output.

Returns:

  • (Boolean)


154
155
156
# File 'lib/covered/wrapper.rb', line 154

def accept?(path)
	match?(path) and super
end

#each {|Coverage| ... } ⇒ Object

Yields:

  • (Coverage)

    the path to the file, and the execution counts.



145
146
147
148
149
# File 'lib/covered/wrapper.rb', line 145

def each(&block)
	@output.each do |coverage|
		yield coverage if accept?(coverage.path)
	end
end

#mark(path, lineno, value) ⇒ Object

Mark coverage if the path is accepted by this filter.



140
141
142
# File 'lib/covered/wrapper.rb', line 140

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

#match?(path) ⇒ Boolean

Whether the given path matches this filter.

Returns:

  • (Boolean)


161
162
163
# File 'lib/covered/wrapper.rb', line 161

def match?(path)
	true
end