Class: Dependabot::Swift::FileUpdater::ManifestUpdater
- Inherits:
-
Object
- Object
- Dependabot::Swift::FileUpdater::ManifestUpdater
- Defined in:
- lib/dependabot/swift/file_updater/manifest_updater.rb
Instance Method Summary collapse
-
#initialize(content, old_requirements:, new_requirements:) ⇒ ManifestUpdater
constructor
A new instance of ManifestUpdater.
- #updated_manifest_content ⇒ Object
Constructor Details
#initialize(content, old_requirements:, new_requirements:) ⇒ ManifestUpdater
Returns a new instance of ManifestUpdater.
11 12 13 14 15 |
# File 'lib/dependabot/swift/file_updater/manifest_updater.rb', line 11 def initialize(content, old_requirements:, new_requirements:) @content = content @old_requirements = old_requirements @new_requirements = new_requirements end |
Instance Method Details
#updated_manifest_content ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/dependabot/swift/file_updater/manifest_updater.rb', line 17 def updated_manifest_content updated_content = content old_requirements.zip(new_requirements).each do |old, new| updated_content = RequirementReplacer.new( content: updated_content, declaration: old[:metadata][:declaration_string], old_requirement: old[:metadata][:requirement_string], new_requirement: new[:metadata][:requirement_string] ).updated_content end updated_content end |