Class: Covered::Root

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

Instance Attribute Summary collapse

Attributes inherited from Wrapper

#output

Instance Method Summary collapse

Methods inherited from Filter

#accept?, #each, #mark

Methods inherited from Wrapper

#accept?, #disable, #each, #enable, #mark, #to_h

Methods inherited from Base

#accept?, #disable, #each, #enable, #mark

Constructor Details

#initialize(output, path) ⇒ Root

Returns a new instance of Root.


128
129
130
131
132
# File 'lib/covered/files.rb', line 128

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

Instance Attribute Details

#pathObject (readonly)

Returns the value of attribute path


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

def path
  @path
end

Instance Method Details

#expand_path(path) ⇒ Object


136
137
138
# File 'lib/covered/files.rb', line 136

def expand_path(path)
	File.expand_path(super, @path)
end

#match?(path) ⇒ Boolean

Returns:

  • (Boolean)

148
149
150
# File 'lib/covered/files.rb', line 148

def match?(path)
	path.start_with?(@path)
end

#relative_path(path) ⇒ Object


140
141
142
143
144
145
146
# File 'lib/covered/files.rb', line 140

def relative_path(path)
	if path.start_with?(@path)
		path.slice(@path.size+1, path.size)
	else
		super
	end
end