Module: SimpleCov::SourceFile::BuilderContext
| Relationships & Source Files | |
| Extension / Inclusion / Inheritance Descendants | |
|
Included In:
| |
| Defined in: | lib/simplecov/source_file/builder_context.rb |
Overview
Helpers shared by the per-criterion builders (LineBuilder /
BranchBuilder / MethodBuilder). Mixed into ::SimpleCov::SourceFile so each
builder can ask the file for its skip-chunk ranges and Prism-derived
real source positions without duplicating the memoization.
Instance Method Summary
-
#real_source_positions
Memoized set of real source positions (branch start lines, method name+line pairs) extracted via Prism.
-
#skip_chunks_for(criterion)
Skip-chunk lookup for the named criterion (
:line,:branch,:method).
Instance Method Details
#real_source_positions
Memoized set of real source positions (branch start lines, method
name+line pairs) extracted via Prism. Returns nil when Prism is
unavailable or parsing fails, signaling callers to keep every
Coverage entry (no false drops). The defined? guard preserves a
nil memoization across calls.
# File 'lib/simplecov/source_file/builder_context.rb', line 21
def real_source_positions return @real_source_positions if defined?(@real_source_positions) @real_source_positions = StaticCoverageExtractor.real_source_positions(src.join) end
#skip_chunks_for(criterion)
Skip-chunk lookup for the named criterion (:line, :branch,
:method).
# File 'lib/simplecov/source_file/builder_context.rb', line 12
def skip_chunks_for(criterion) (@skip_chunks ||= SkipChunks.new(filename, src)).for(criterion) end