Module: SimpleCov::Formatter::AIFormatter::MarkdownBuilder::SourceLines

Extended by:
T::Sig
Defined in:
lib/simplecov-ai/markdown_builder/source_lines.rb

Overview

Reads a file's source through the SourceFile SimpleCov already loaded — honouring the shebang and encoding magic comment and transcoding to UTF-8 — instead of re-reading the file from disk. Invalid byte sequences (which SimpleCov < 1.0 leaves in place) are scrubbed so snippets can be stripped and joined without raising.

Class Method Summary collapse

Class Method Details

.of(file) ⇒ Object



19
20
21
22
23
# File 'lib/simplecov-ai/markdown_builder/source_lines.rb', line 19

def self.of(file)
  file.src.map(&:scrub)
rescue StandardError
  []
end