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
11 12 13 14 15 16 17 18 19 |
# File 'lib/bibliothecary/multi_parsers/dependencies_csv.rb', line 11 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
135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 |
# File 'lib/bibliothecary/multi_parsers/dependencies_csv.rb', line 135 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 do |dep_kvs| Dependency.new( **dep_kvs, source: .fetch(:filename, nil) ) end end |