Class: Bibliothecary::Parsers::Meteor
- Inherits:
-
Object
- Object
- Bibliothecary::Parsers::Meteor
- Includes:
- Analyser
- Defined in:
- lib/bibliothecary/parsers/meteor.rb
Class Method Summary collapse
- .map_dependencies(hash, key, type) ⇒ Object
- .parse(filename, path) ⇒ Object
- .parse_manifest(manifest) ⇒ Object
Methods included from Analyser
Class Method Details
.map_dependencies(hash, key, type) ⇒ Object
22 23 24 25 26 27 28 29 30 |
# File 'lib/bibliothecary/parsers/meteor.rb', line 22 def self.map_dependencies(hash, key, type) hash.fetch(key,[]).map do |name, requirement| { name: name, requirement: requirement, type: type } end end |
.parse(filename, path) ⇒ Object
8 9 10 11 12 13 14 15 16 |
# File 'lib/bibliothecary/parsers/meteor.rb', line 8 def self.parse(filename, path) if filename.match(/^versions\.json$/) file_contents = File.open(path).read json = JSON.parse(file_contents) parse_manifest(json) else [] end end |
.parse_manifest(manifest) ⇒ Object
18 19 20 |
# File 'lib/bibliothecary/parsers/meteor.rb', line 18 def self.parse_manifest(manifest) map_dependencies(manifest, 'dependencies', 'runtime') end |