Class: Dependabot::Package::NpmLockfileDetails

Inherits:
T::ImmutableStruct
  • Object
show all
Extended by:
T::Sig
Defined in:
lib/dependabot/package/npm_lockfile_details.rb

Class Method Summary collapse

Class Method Details

.from_object(value, path:, context:) ⇒ Object



17
18
19
20
21
22
23
24
25
# File 'lib/dependabot/package/npm_lockfile_details.rb', line 17

def self.from_object(value, path:, context:)
  raise DependencyFileNotParseable.new(path, "#{context} must be an object") unless value.is_a?(Hash)

  new(
    version: optional_string(T.cast(value["version"], Object), path, "#{context}.version"),
    resolved: optional_string(T.cast(value["resolved"], Object), path, "#{context}.resolved"),
    resolution: optional_string(T.cast(value["resolution"], Object), path, "#{context}.resolution")
  )
end