Class: Dependabot::Cargo::FileUpdater::WorkspaceManifestUpdater
- Inherits:
-
Object
- Object
- Dependabot::Cargo::FileUpdater::WorkspaceManifestUpdater
- Extended by:
- T::Sig
- Defined in:
- lib/dependabot/cargo/file_updater/workspace_manifest_updater.rb
Instance Method Summary collapse
-
#initialize(dependencies:, manifest:) ⇒ WorkspaceManifestUpdater
constructor
A new instance of WorkspaceManifestUpdater.
- #updated_manifest_content ⇒ Object
Constructor Details
#initialize(dependencies:, manifest:) ⇒ WorkspaceManifestUpdater
Returns a new instance of WorkspaceManifestUpdater.
14 15 16 17 |
# File 'lib/dependabot/cargo/file_updater/workspace_manifest_updater.rb', line 14 def initialize(dependencies:, manifest:) @dependencies = T.let(dependencies, T::Array[Dependabot::Dependency]) @manifest = T.let(manifest, Dependabot::DependencyFile) end |
Instance Method Details
#updated_manifest_content ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/dependabot/cargo/file_updater/workspace_manifest_updater.rb', line 20 def updated_manifest_content workspace_deps = dependencies.select { |dep| workspace_dependency?(dep) } return T.must(manifest.content) if workspace_deps.empty? T.must( workspace_deps.reduce(manifest.content.dup) do |content, dep| update_workspace_dependency(T.must(content), dep) end ) end |