Class: Covered::Files

Inherits:
Base
  • Object
show all
Defined in:
lib/covered/files.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#accept?, #expand_path, #finish, #relative_path, #start

Constructor Details

#initializeFiles

Returns a new instance of Files.



13
14
15
16
17
# File 'lib/covered/files.rb', line 13

def initialize(*)
	super
	
	@paths = {}
end

Instance Attribute Details

#pathsObject

Returns the value of attribute paths.



19
20
21
# File 'lib/covered/files.rb', line 19

def paths
  @paths
end

Instance Method Details

#[](path) ⇒ Object



21
22
23
# File 'lib/covered/files.rb', line 21

def [](path)
	@paths[path] ||= Coverage.for(path)
end

#add(coverage) ⇒ Object



37
38
39
# File 'lib/covered/files.rb', line 37

def add(coverage)
	self[coverage.path].merge!(coverage)
end

#annotate(path, line_number, value) ⇒ Object



33
34
35
# File 'lib/covered/files.rb', line 33

def annotate(path, line_number, value)
	self[path].annotate(line_number, value)
end

#clearObject



49
50
51
# File 'lib/covered/files.rb', line 49

def clear
	@paths.clear
end

#eachObject



41
42
43
44
45
46
47
# File 'lib/covered/files.rb', line 41

def each
	return to_enum unless block_given?
	
	@paths.each_value do |coverage|
		yield coverage
	end
end

#empty?Boolean

Returns:

  • (Boolean)


25
26
27
# File 'lib/covered/files.rb', line 25

def empty?
	@paths.empty?
end

#mark(path, line_number, value) ⇒ Object



29
30
31
# File 'lib/covered/files.rb', line 29

def mark(path, line_number, value)
	self[path].mark(line_number, value)
end