Class: Covered::Capture

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, #mark, #to_h

Constructor Details

#initialize(output) ⇒ Capture

Returns a new instance of Capture.



27
28
29
30
31
32
33
34
35
# File 'lib/covered/capture.rb', line 27

def initialize(output)
	super(output)
	
	@trace = TracePoint.new(:line, :call) do |event|
		if path = event.path
			@output.mark(path, event.lineno)
		end
	end
end

Instance Method Details

#disableObject



43
44
45
46
47
# File 'lib/covered/capture.rb', line 43

def disable
	@trace.disable
	
	super
end

#enableObject



37
38
39
40
41
# File 'lib/covered/capture.rb', line 37

def enable
	super
	
	@trace.enable
end