Class: Dependabot::Nuget::WorkspaceDiscovery

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(file_path:, projects:, directory_packages_props:, global_json:, dotnet_tools_json:) ⇒ WorkspaceDiscovery

Returns a new instance of WorkspaceDiscovery.



42
43
44
45
46
47
48
# File 'lib/dependabot/nuget/discovery/workspace_discovery.rb', line 42

def initialize(file_path:, projects:, directory_packages_props:, global_json:, dotnet_tools_json:)
  @file_path = file_path
  @projects = projects
  @directory_packages_props = directory_packages_props
  @global_json = global_json
  @dotnet_tools_json = dotnet_tools_json
end

Instance Attribute Details

#directory_packages_propsObject (readonly)

Returns the value of attribute directory_packages_props.



57
58
59
# File 'lib/dependabot/nuget/discovery/workspace_discovery.rb', line 57

def directory_packages_props
  @directory_packages_props
end

#dotnet_tools_jsonObject (readonly)

Returns the value of attribute dotnet_tools_json.



63
64
65
# File 'lib/dependabot/nuget/discovery/workspace_discovery.rb', line 63

def dotnet_tools_json
  @dotnet_tools_json
end

#file_pathObject (readonly)

Returns the value of attribute file_path.



51
52
53
# File 'lib/dependabot/nuget/discovery/workspace_discovery.rb', line 51

def file_path
  @file_path
end

#global_jsonObject (readonly)

Returns the value of attribute global_json.



60
61
62
# File 'lib/dependabot/nuget/discovery/workspace_discovery.rb', line 60

def global_json
  @global_json
end

#projectsObject (readonly)

Returns the value of attribute projects.



54
55
56
# File 'lib/dependabot/nuget/discovery/workspace_discovery.rb', line 54

def projects
  @projects
end

Class Method Details

.from_json(json) ⇒ Object



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/dependabot/nuget/discovery/workspace_discovery.rb', line 15

def self.from_json(json)
  file_path = T.let(json.fetch("FilePath"), String)
  projects = T.let(json.fetch("Projects"), T::Array[T::Hash[String, T.untyped]]).filter_map do |project|
    ProjectDiscovery.from_json(project)
  end
  directory_packages_props = DirectoryPackagesPropsDiscovery
                             .from_json(T.let(json.fetch("DirectoryPackagesProps"),
                                              T.nilable(T::Hash[String, T.untyped])))
  global_json = DependencyFileDiscovery
                .from_json(T.let(json.fetch("GlobalJson"), T.nilable(T::Hash[String, T.untyped])))
  dotnet_tools_json = DependencyFileDiscovery
                      .from_json(T.let(json.fetch("DotNetToolsJson"), T.nilable(T::Hash[String, T.untyped])))

  WorkspaceDiscovery.new(file_path: file_path,
                         projects: projects,
                         directory_packages_props: directory_packages_props,
                         global_json: global_json,
                         dotnet_tools_json: dotnet_tools_json)
end