Module: SimpleCov::SourceFile::BuilderContext

Included in:
SimpleCov::SourceFile
Defined in:
lib/simplecov/source_file/builder_context.rb,
sig/simplecov.rbs

Instance Method Summary collapse

Instance Method Details

#filenameString

Returns:



979
# File 'sig/simplecov.rbs', line 979

def filename: () -> String

#real_source_positionsreal_positions?

Memoized set of real source positions extracted via Prism. Nil when Prism is unavailable or parsing fails, signaling callers to keep every Coverage entry rather than risk false drops. The defined? guard preserves a nil memoization across calls.

Nil for a template too, without parsing: every entry a template reports is eval-generated by construction, so the filter has nothing to distinguish there, and a template whose text happens to parse as Ruby (a Haml #id tag reads as a comment) would otherwise lose its real branches to a confident wrong parse.

Returns:



20
21
22
23
24
25
# File 'lib/simplecov/source_file/builder_context.rb', line 20

def real_source_positions
  return @real_source_positions if instance_variable_defined?(:@real_source_positions)
  return @real_source_positions = nil if Directive::Template.template?(filename)

  @real_source_positions = StaticCoverageExtractor.real_source_positions(src.join)
end

#skip_chunks_for(criterion) ⇒ Array[Range[Integer]]

Parameters:

Returns:



6
7
8
# File 'lib/simplecov/source_file/builder_context.rb', line 6

def skip_chunks_for(criterion)
  (@skip_chunks ||= SkipChunks.new(filename, src)).chunks_for(criterion)
end

#srcArray[String]

Returns:



980
# File 'sig/simplecov.rbs', line 980

def src: () -> Array[String]