Class: Dependabot::Nuget::DependencyAnalysis

Inherits:
Object
  • Object
show all
Extended by:
T::Sig
Defined in:
lib/dependabot/nuget/analysis/dependency_analysis.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(updated_version:, can_update:, version_comes_from_multi_dependency_property:, updated_dependencies:) ⇒ DependencyAnalysis

Returns a new instance of DependencyAnalysis.



37
38
39
40
41
42
43
# File 'lib/dependabot/nuget/analysis/dependency_analysis.rb', line 37

def initialize(updated_version:, can_update:, version_comes_from_multi_dependency_property:,
               updated_dependencies:)
  @updated_version = updated_version
  @can_update = can_update
  @version_comes_from_multi_dependency_property = version_comes_from_multi_dependency_property
  @updated_dependencies = updated_dependencies
end

Instance Attribute Details

#can_updateObject (readonly)

Returns the value of attribute can_update.



49
50
51
# File 'lib/dependabot/nuget/analysis/dependency_analysis.rb', line 49

def can_update
  @can_update
end

#updated_dependenciesObject (readonly)

Returns the value of attribute updated_dependencies.



55
56
57
# File 'lib/dependabot/nuget/analysis/dependency_analysis.rb', line 55

def updated_dependencies
  @updated_dependencies
end

#updated_versionObject (readonly)

Returns the value of attribute updated_version.



46
47
48
# File 'lib/dependabot/nuget/analysis/dependency_analysis.rb', line 46

def updated_version
  @updated_version
end

#version_comes_from_multi_dependency_propertyObject (readonly)

Returns the value of attribute version_comes_from_multi_dependency_property.



52
53
54
# File 'lib/dependabot/nuget/analysis/dependency_analysis.rb', line 52

def version_comes_from_multi_dependency_property
  @version_comes_from_multi_dependency_property
end

Class Method Details

.from_json(json) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/dependabot/nuget/analysis/dependency_analysis.rb', line 13

def self.from_json(json)
  updated_version = T.let(json.fetch("UpdatedVersion"), String)
  can_update = T.let(json.fetch("CanUpdate"), T::Boolean)
  version_comes_from_multi_dependency_property = T.let(json.fetch("VersionComesFromMultiDependencyProperty"),
                                                       T::Boolean)
  updated_dependencies = T.let(json.fetch("UpdatedDependencies"),
                               T::Array[T::Hash[String, T.untyped]]).map do |dep|
    NativeDependencyDetails.from_json(dep)
  end

  DependencyAnalysis.new(
    updated_version: updated_version,
    can_update: can_update,
    version_comes_from_multi_dependency_property: version_comes_from_multi_dependency_property,
    updated_dependencies: updated_dependencies
  )
end

Instance Method Details

#numeric_updated_versionObject



58
59
60
# File 'lib/dependabot/nuget/analysis/dependency_analysis.rb', line 58

def numeric_updated_version
  @numeric_updated_version ||= T.let(Version.new(updated_version), T.nilable(Dependabot::Nuget::Version))
end