Class: Dependabot::Nuget::NativeDirectoryPackagesPropsDiscovery

Inherits:
NativeDependencyFileDiscovery show all
Extended by:
T::Sig
Defined in:
lib/dependabot/nuget/native_discovery/native_directory_packages_props_discovery.rb

Instance Attribute Summary collapse

Attributes inherited from NativeDependencyFileDiscovery

#dependencies, #file_path

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from NativeDependencyFileDiscovery

#dependency_set

Constructor Details

#initialize(file_path:, is_transitive_pinning_enabled:, dependencies:) ⇒ NativeDirectoryPackagesPropsDiscovery

Returns a new instance of NativeDirectoryPackagesPropsDiscovery.



35
36
37
38
# File 'lib/dependabot/nuget/native_discovery/native_directory_packages_props_discovery.rb', line 35

def initialize(file_path:, is_transitive_pinning_enabled:, dependencies:)
  super(file_path: file_path, dependencies: dependencies)
  @is_transitive_pinning_enabled = is_transitive_pinning_enabled
end

Instance Attribute Details

#is_transitive_pinning_enabledObject (readonly)

Returns the value of attribute is_transitive_pinning_enabled.



41
42
43
# File 'lib/dependabot/nuget/native_discovery/native_directory_packages_props_discovery.rb', line 41

def is_transitive_pinning_enabled
  @is_transitive_pinning_enabled
end

Class Method Details

.from_json(json, directory) ⇒ Object



16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/dependabot/nuget/native_discovery/native_directory_packages_props_discovery.rb', line 16

def self.from_json(json, directory)
  return nil if json.nil?

  file_path = File.join(directory, T.let(json.fetch("FilePath"), String))
  is_transitive_pinning_enabled = T.let(json.fetch("IsTransitivePinningEnabled"), T::Boolean)
  dependencies = T.let(json.fetch("Dependencies"), T::Array[T::Hash[String, T.untyped]]).map do |dep|
    NativeDependencyDetails.from_json(dep)
  end

  NativeDirectoryPackagesPropsDiscovery.new(file_path: file_path,
                                            is_transitive_pinning_enabled: is_transitive_pinning_enabled,
                                            dependencies: dependencies)
end