Class: Covered::Capture

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

Instance Attribute Summary collapse

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.



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

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

Instance Attribute Details

#pathsObject (readonly)

Returns the value of attribute paths.



35
36
37
# File 'lib/covered/capture.rb', line 35

def paths
  @paths
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