Class: Covered::Only

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

Overview

Only includes 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) ⇒ Only

Initialize an only filter for the given pattern.



159
160
161
162
163
# File 'lib/covered/files.rb', line 159

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

Instance Attribute Details

#patternObject (readonly)

Returns the value of attribute pattern.



166
167
168
# File 'lib/covered/files.rb', line 166

def pattern
  @pattern
end

Instance Method Details

#match?(path) ⇒ Boolean

Whether the given path matches the only pattern.

Returns:

  • (Boolean)


171
172
173
# File 'lib/covered/files.rb', line 171

def match?(path)
	@pattern === path
end

#The pattern matched with `===`.=(patternmatchedwith` = ==`.=(value)) ⇒ Object



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

attr :pattern