Class: Dependabot::Hex::FileUpdater::MixfileUpdater
- Inherits:
-
Object
- Object
- Dependabot::Hex::FileUpdater::MixfileUpdater
- Defined in:
- lib/dependabot/hex/file_updater/mixfile_updater.rb
Instance Method Summary collapse
-
#initialize(mixfile:, dependencies:) ⇒ MixfileUpdater
constructor
A new instance of MixfileUpdater.
- #updated_mixfile_content ⇒ Object
Constructor Details
#initialize(mixfile:, dependencies:) ⇒ MixfileUpdater
Returns a new instance of MixfileUpdater.
12 13 14 15 |
# File 'lib/dependabot/hex/file_updater/mixfile_updater.rb', line 12 def initialize(mixfile:, dependencies:) @mixfile = mixfile @dependencies = dependencies end |
Instance Method Details
#updated_mixfile_content ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/dependabot/hex/file_updater/mixfile_updater.rb', line 17 def updated_mixfile_content dependencies .select { |dep| requirement_changed?(mixfile, dep) } .reduce(mixfile.content.dup) do |content, dep| updated_content = content updated_content = update_requirement( content: updated_content, filename: mixfile.name, dependency: dep ) updated_content = update_git_pin( content: updated_content, filename: mixfile.name, dependency: dep ) raise "Expected content to change!" if content == updated_content updated_content end end |