Class: Covered::Cache

Inherits:
Wrapper show all
Defined in:
lib/covered/capture.rb

Instance Attribute Summary

Attributes inherited from Wrapper

#output

Instance Method Summary collapse

Methods inherited from Wrapper

#each, #to_h

Constructor Details

#initialize(output) ⇒ Cache

Returns a new instance of Cache.



51
52
53
54
# File 'lib/covered/capture.rb', line 51

def initialize(output)
	super(output)
	@marks = []
end

Instance Method Details

#disableObject



72
73
74
75
76
# File 'lib/covered/capture.rb', line 72

def disable
	super
	
	flush
end

#enableObject



60
61
62
# File 'lib/covered/capture.rb', line 60

def enable
	super
end

#flushObject



64
65
66
67
68
69
70
# File 'lib/covered/capture.rb', line 64

def flush
	@marks.each_slice(3) do |path, lineno, count|
		@output.mark(path, lineno, count)
	end
	
	@marks.clear
end

#mark(path, lineno, count = 1) ⇒ Object



56
57
58
# File 'lib/covered/capture.rb', line 56

def mark(path, lineno, count = 1)
	@marks << path << lineno << count
end