module Bibliothecary::MultiParsers::DependenciesCSV

Public Class Methods

mapping() click to toggle source
# File lib/bibliothecary/multi_parsers/dependencies_csv.rb, line 9
def self.mapping
  {
    match_filename("dependencies.csv") => {
      kind: "lockfile",
      ungroupable: true,
      parser: :parse_dependencies_csv,
    },
  }
end

Public Instance Methods

parse_dependencies_csv(file_contents, options: {}) click to toggle source
# File lib/bibliothecary/multi_parsers/dependencies_csv.rb, line 139
def parse_dependencies_csv(file_contents, options: {})
  csv_file = try_cache(options, options[:filename]) do
    raw_csv_file = CSVFile.new(file_contents)
    raw_csv_file.parse!
    raw_csv_file
  end

  csv_file
    .result
    .find_all { |dependency| dependency[:platform] == platform_name.to_s }
    .map { |dep_kvs| Dependency.new(**dep_kvs) }
end