class SimpleCov::Result::SourceFileBuilder
silent drop (see #980).
is no longer present on disk so the caller can warn about the
hash, sorts them by filename, and surfaces filenames whose source
Constructs ‘SimpleCov::SourceFile` instances from a raw coverage
def build_source_file(filename, coverage)
def build_source_file(filename, coverage) unless File.file?(filename) @missing_source_files << filename return end SimpleCov::SourceFile.new( filename, stringify_outer_keys(coverage), loaded: !@not_loaded_files.include?(filename) ) end
def call
def call SimpleCov::FileList.new( @original_result .filter_map { |filename, coverage| build_source_file(filename, coverage) } .sort_by(&:filename) ) end
def initialize(original_result, not_loaded_files:)
def initialize(original_result, not_loaded_files:) @original_result = original_result @not_loaded_files = not_loaded_files @missing_source_files = [] end
def stringify_outer_keys(coverage)
stringified-Array branch/method keys via `restore_ruby_data_structure`,
SourceFile reads with strings, and handles both Array and
`:methods`); resultsets loaded from disk are already string-keyed.
`Coverage.result` returns symbol keys (`:lines`, `:branches`,
def stringify_outer_keys(coverage) coverage.transform_keys(&:to_s) end