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.



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

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

Instance Attribute Details

#pathObject (readonly)

Returns the value of attribute path.



151
152
153
# File 'lib/covered/files.rb', line 151

def path
  @path
end

Instance Method Details

#accept?(path) ⇒ Boolean

Returns:

  • (Boolean)


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

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

#expand_path(path) ⇒ Object



153
154
155
# File 'lib/covered/files.rb', line 153

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

#relative_path(path) ⇒ Object



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

def relative_path(path)
	if path.start_with?(@path)
		path[@path.size+1..-1]
	else
		super
	end
end