Class: Dependabot::Python::FileParser::PoetryLock::Package

Inherits:
T::ImmutableStruct
  • Object
show all
Extended by:
T::Sig
Defined in:
lib/dependabot/python/file_parser/poetry_lock.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.from_object(value) ⇒ Object



25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/dependabot/python/file_parser/poetry_lock.rb', line 25

def self.from_object(value)
  hash = PyprojectValueParser.object_hash(value, "Poetry lock package")
  source = hash["source"]
  source_hash =
    if source.nil?
      nil
    else
      PyprojectValueParser.object_hash(source, "Poetry lock package source")
    end

  new(
    name: PyprojectValueParser.string(hash["name"], "Poetry lock package name"),
    version: PyprojectValueParser.string(hash["version"], "Poetry lock package version"),
    source_type: PyprojectValueParser.optional_string(
      source_hash&.[]("type"),
      "Poetry lock package source type"
    )
  )
end

Instance Method Details

#to_hObject



46
47
48
49
50
51
52
# File 'lib/dependabot/python/file_parser/poetry_lock.rb', line 46

def to_h
  {
    name: name,
    version: version,
    source_type: source_type
  }
end