Class: Mutant::LineTrace
- Inherits:
-
Object
- Object
- Mutant::LineTrace
- Includes:
- Adamantium::Flat
- Defined in:
- lib/mutant/line_trace.rb
Overview
Line tracer
Class Method Summary collapse
-
.call(&block) ⇒ Traces
private
Run block.
Instance Method Summary collapse
-
#cover?(file, lineno) ⇒ Boolean
Test if trace coveres file at lineno.
Class Method Details
.call(&block) ⇒ Traces
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Run block
25 26 27 28 29 30 31 |
# File 'lib/mutant/line_trace.rb', line 25 def self.call(&block) traces = Hash.new { |hash, file| hash[file] = Set.new } TracePoint.trace(:return, :line) do |point| traces[point.path] << point.lineno end.tap(&block).disable new(IceNine.deep_freeze(traces)) end |
Instance Method Details
#cover?(file, lineno) ⇒ Boolean
Test if trace coveres file at lineno
15 16 17 |
# File 'lib/mutant/line_trace.rb', line 15 def cover?(file, lineno) contents.fetch(file) { return false }.include?(lineno) end |