Module: SimpleCov::SourceFile::BuilderContext
- Included in:
- SimpleCov::SourceFile
- Defined in:
- lib/simplecov/source_file/builder_context.rb,
sig/simplecov.rbs
Instance Method Summary collapse
- #filename ⇒ String
-
#real_source_positions ⇒ real_positions?
Memoized set of real source positions extracted via Prism.
- #skip_chunks_for(criterion) ⇒ Array[Range[Integer]]
- #src ⇒ Array[String]
Instance Method Details
#filename ⇒ String
979 |
# File 'sig/simplecov.rbs', line 979
def filename: () -> String
|
#real_source_positions ⇒ real_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.
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]]
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 |
#src ⇒ Array[String]
980 |
# File 'sig/simplecov.rbs', line 980
def src: () -> Array[String]
|