Class: Dependabot::Swift::FileUpdater::RequirementReplacer
- Inherits:
-
Object
- Object
- Dependabot::Swift::FileUpdater::RequirementReplacer
- Defined in:
- lib/dependabot/swift/file_updater/requirement_replacer.rb
Instance Method Summary collapse
-
#initialize(content:, declaration:, old_requirement:, new_requirement:) ⇒ RequirementReplacer
constructor
A new instance of RequirementReplacer.
- #updated_content ⇒ Object
Constructor Details
#initialize(content:, declaration:, old_requirement:, new_requirement:) ⇒ RequirementReplacer
Returns a new instance of RequirementReplacer.
10 11 12 13 14 15 |
# File 'lib/dependabot/swift/file_updater/requirement_replacer.rb', line 10 def initialize(content:, declaration:, old_requirement:, new_requirement:) @content = content @declaration = declaration @old_requirement = old_requirement @new_requirement = new_requirement end |
Instance Method Details
#updated_content ⇒ Object
17 18 19 20 21 |
# File 'lib/dependabot/swift/file_updater/requirement_replacer.rb', line 17 def updated_content content.gsub(declaration) do |match| match.to_s.sub(old_requirement, new_requirement) end end |