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

#accept?, #each, #expand_path, #relative_path, #to_h

Methods inherited from Base

#accept?, #each, #expand_path, #relative_path

Constructor Details

#initialize(output) ⇒ Cache

Returns a new instance of Cache.



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

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

Instance Method Details

#disableObject



77
78
79
80
81
# File 'lib/covered/capture.rb', line 77

def disable
  super
  
  flush
end

#enableObject



65
66
67
# File 'lib/covered/capture.rb', line 65

def enable
  super
end

#flushObject



69
70
71
72
73
74
75
# File 'lib/covered/capture.rb', line 69

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



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

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