Class: Covered::Capture
Constant Summary
collapse
- EVAL_PATHS =
{
"(eval)" => true,
"(irb)" => true,
"eval" => true
}
Instance Attribute Summary
Attributes inherited from Wrapper
#output
Instance Method Summary
collapse
Methods inherited from Wrapper
#accept?, #add, #each, #expand_path, #initialize, #mark, #relative_path, #to_h
Methods inherited from Base
#accept?, #add, #each, #expand_path, #mark, #relative_path
Instance Method Details
#clear ⇒ Object
18
19
20
21
22
|
# File 'lib/covered/capture.rb', line 18
def clear
super
::Coverage.result(stop: false, clear: true)
end
|
#execute(source, binding: TOPLEVEL_BINDING) ⇒ Object
50
51
52
53
54
55
56
|
# File 'lib/covered/capture.rb', line 50
def execute(source, binding: TOPLEVEL_BINDING)
start
eval(source.code!, binding, source.path, source.line_offset)
ensure
finish
end
|
#finish ⇒ Object
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
# File 'lib/covered/capture.rb', line 30
def finish
results = ::Coverage.result
results.each do |path, result|
next if EVAL_PATHS.include?(path)
path = self.expand_path(path)
if File.exist?(path)
@output.mark(path, 1, result[:lines])
else
end
end
super
end
|
#start ⇒ Object
12
13
14
15
16
|
# File 'lib/covered/capture.rb', line 12
def start
super
::Coverage.start(lines: true, eval: true)
end
|