Class: Covered::Skip

Inherits:
Filter show all
Defined in:
lib/covered/files.rb

Overview

Excludes coverage for paths matching a pattern.

Instance Attribute Summary collapse

Attributes inherited from Wrapper

#The wrapped output., #output

Instance Method Summary collapse

Methods inherited from Filter

#accept?, #each, #mark

Methods inherited from Wrapper

#accept?, #add, #clear, #each, #expand_path, #finish, #mark, #relative_path, #start, #to_h

Methods inherited from Base

#accept?, #add, #clear, #each, #expand_path, #finish, #mark, #relative_path, #start

Constructor Details

#initialize(output, pattern) ⇒ Skip

Initialize a skip filter for the given pattern.



133
134
135
136
137
# File 'lib/covered/files.rb', line 133

def initialize(output, pattern)
	super(output)
	
	@pattern = pattern
end

Instance Attribute Details

#patternObject (readonly)

Returns the value of attribute pattern.



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

def pattern
  @pattern
end

Instance Method Details

#match?(path) ⇒ Boolean

This is better as it doesn’t allocate a MatchData instance which is essentially useless:

Returns:

  • (Boolean)


144
145
146
# File 'lib/covered/files.rb', line 144

def match? path
	!@pattern.match?(path)
end

#The pattern to exclude.=(patterntoexclude. = (value)) ⇒ Object



140
# File 'lib/covered/files.rb', line 140

attr :pattern