Class: Covered::Capture
Instance Attribute Summary
Attributes inherited from Wrapper
Instance Method Summary collapse
- #disable ⇒ Object
- #enable ⇒ Object
-
#initialize(output) ⇒ Capture
constructor
A new instance of Capture.
Methods inherited from Wrapper
#accept?, #each, #expand_path, #mark, #relative_path, #to_h
Methods inherited from Base
#accept?, #each, #expand_path, #mark, #relative_path
Constructor Details
#initialize(output) ⇒ Capture
Returns a new instance of Capture.
27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/covered/capture.rb', line 27 def initialize(output) super(output) begin @trace = TracePoint.new(:line, :call, :c_call) do |event| if path = event.path @output.mark(path, event.lineno, 1) end end rescue warn "Line coverage disabled: #{$!}" @trace = nil end end |
Instance Method Details
#disable ⇒ Object
48 49 50 51 52 |
# File 'lib/covered/capture.rb', line 48 def disable @trace&.disable super end |
#enable ⇒ Object
42 43 44 45 46 |
# File 'lib/covered/capture.rb', line 42 def enable super @trace&.enable end |