Class: Dependabot::Nix::Lockfile
- Inherits:
-
Object
- Object
- Dependabot::Nix::Lockfile
- Extended by:
- T::Sig
- Defined in:
- lib/dependabot/nix/lockfile.rb
Constant Summary collapse
- Node =
T.type_alias { T::Hash[String, Object] }
Instance Method Summary collapse
-
#initialize(content) ⇒ Lockfile
constructor
A new instance of Lockfile.
- #input_node(input_name) ⇒ Object
- #input_path(input_name) ⇒ Object
- #locked_revision(input_name) ⇒ Object
- #locked_source(input_name) ⇒ Object
- #original_source(input_name) ⇒ Object
- #root_input_names ⇒ Object
- #version ⇒ Object
Constructor Details
Instance Method Details
#input_node(input_name) ⇒ Object
40 41 42 43 44 45 46 |
# File 'lib/dependabot/nix/lockfile.rb', line 40 def input_node(input_name) label = resolve_reference(root_inputs[input_name], T.let(Set.new, T::Set[String])) return unless label node = nodes[label] node if node.is_a?(Hash) end |
#input_path(input_name) ⇒ Object
31 32 33 34 35 36 37 |
# File 'lib/dependabot/nix/lockfile.rb', line 31 def input_path(input_name) reference = root_inputs[input_name] return [input_name] if reference.is_a?(String) return unless string_array?(reference) T.cast(reference, T::Array[String]) end |
#locked_revision(input_name) ⇒ Object
61 62 63 64 65 66 67 |
# File 'lib/dependabot/nix/lockfile.rb', line 61 def locked_revision(input_name) locked = locked_source(input_name) return unless locked revision = locked["rev"] revision if revision.is_a?(String) end |
#locked_source(input_name) ⇒ Object
55 56 57 58 |
# File 'lib/dependabot/nix/lockfile.rb', line 55 def locked_source(input_name) locked = input_node(input_name)&.fetch("locked", nil) locked if locked.is_a?(Hash) end |
#original_source(input_name) ⇒ Object
49 50 51 52 |
# File 'lib/dependabot/nix/lockfile.rb', line 49 def original_source(input_name) original = input_node(input_name)&.fetch("original", nil) original if original.is_a?(Hash) end |
#root_input_names ⇒ Object
26 27 28 |
# File 'lib/dependabot/nix/lockfile.rb', line 26 def root_input_names root_inputs.keys end |
#version ⇒ Object
20 21 22 23 |
# File 'lib/dependabot/nix/lockfile.rb', line 20 def version value = @data["version"] value if value.is_a?(Integer) end |