Class: Bibliothecary::Parsers::Elm

Inherits:
Object
  • Object
show all
Extended by:
MultiParsers::JSONRuntime
Includes:
Analyser
Defined in:
lib/bibliothecary/parsers/elm.rb

Class Method Summary collapse

Methods included from MultiParsers::JSONRuntime

parse_json_runtime_manifest

Methods included from Analyser

create_analysis, create_error_analysis, included

Class Method Details

.mappingObject



9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/bibliothecary/parsers/elm.rb', line 9

def self.mapping
  {
    match_filenames("elm-package.json", "elm_dependencies.json") => {
      kind: "manifest",
      parser: :parse_json_runtime_manifest,
    },
    match_filename("elm-stuff/exact-dependencies.json") => {
      kind: "lockfile",
      parser: :parse_json_lock,
    },
  }
end

.parse_json_lock(file_contents, options: {}) ⇒ Object

rubocop:disable Lint/UnusedMethodArgument



24
25
26
27
28
29
30
31
32
33
# File 'lib/bibliothecary/parsers/elm.rb', line 24

def self.parse_json_lock(file_contents, options: {}) # rubocop:disable Lint/UnusedMethodArgument
  manifest = JSON.parse file_contents
  manifest.map do |name, requirement|
    {
      name: name,
      requirement: requirement,
      type: "runtime",
    }
  end
end