Module: Bibliothecary::MultiParsers::DependenciesCSV
- Includes:
- Analyser, Analyser::TryCache
- Defined in:
- lib/bibliothecary/multi_parsers/dependencies_csv.rb
Defined Under Namespace
Classes: CSVFile
Class Method Summary collapse
Instance Method Summary collapse
Methods included from Analyser::TryCache
Methods included from Analyser
create_analysis, create_error_analysis, included
Class Method Details
.mapping ⇒ Object
9 10 11 12 13 14 15 16 17 |
# 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 |
Instance Method Details
#parse_dependencies_csv(file_contents, options: {}) ⇒ Object
132 133 134 135 136 137 138 139 140 141 142 143 |
# File 'lib/bibliothecary/multi_parsers/dependencies_csv.rb', line 132 def parse_dependencies_csv(file_contents, options: {}) csv_file = try_cache(, [: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 |