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?, #add, #clear, #each, #finish, #mark, #start, #to_h

Methods inherited from Base

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

Constructor Details

#initialize(output, path) ⇒ Root

Returns a new instance of Root.



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

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

Instance Attribute Details

#pathObject (readonly)

Returns the value of attribute path.



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

def path
  @path
end

Instance Method Details

#expand_path(path) ⇒ Object



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

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

#match?(path) ⇒ Boolean

Returns:

  • (Boolean)


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

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

#relative_path(path) ⇒ Object



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

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