Module: Bibliothecary::MultiParsers::JSONRuntime

Included in:
Parsers::Dub, Parsers::Elm, Parsers::Haxelib, Parsers::Meteor, Parsers::Nuget
Defined in:
lib/bibliothecary/multi_parsers/json_runtime.rb

Overview

Provide JSON Runtime Manifest parsing

Instance Method Summary collapse

Instance Method Details

#parse_json_runtime_manifest(file_contents, options: {}) ⇒ Object



7
8
9
10
11
12
13
14
15
16
# File 'lib/bibliothecary/multi_parsers/json_runtime.rb', line 7

def parse_json_runtime_manifest(file_contents, options: {})
  JSON.parse(file_contents).fetch("dependencies", []).map do |name, requirement|
    Dependency.new(
      name: name,
      requirement: requirement,
      type: "runtime",
      source: options.fetch(:filename, nil)
    )
  end
end