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

#each, #mark

Methods inherited from Wrapper

#disable, #each, #enable, #mark, #to_h

Constructor Details

#initialize(output, path) ⇒ Root

Returns a new instance of Root.



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

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

Instance Attribute Details

#pathObject (readonly)

Returns the value of attribute path.



146
147
148
# File 'lib/covered/files.rb', line 146

def path
  @path
end

Instance Method Details

#accept?(path) ⇒ Boolean

Returns:

  • (Boolean)


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

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

#expand_path(path) ⇒ Object



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

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

#relative_path(path) ⇒ Object



152
153
154
155
156
157
158
# File 'lib/covered/files.rb', line 152

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