Class: Dependabot::Hex::FileUpdater::MixfileSanitizer

Inherits:
Object
  • Object
show all
Defined in:
lib/dependabot/hex/file_updater/mixfile_sanitizer.rb

Instance Method Summary collapse

Constructor Details

#initialize(mixfile_content:) ⇒ MixfileSanitizer

Returns a new instance of MixfileSanitizer.



10
11
12
# File 'lib/dependabot/hex/file_updater/mixfile_sanitizer.rb', line 10

def initialize(mixfile_content:)
  @mixfile_content = mixfile_content
end

Instance Method Details

#sanitized_contentObject



14
15
16
17
18
19
# File 'lib/dependabot/hex/file_updater/mixfile_sanitizer.rb', line 14

def sanitized_content
  mixfile_content.
    gsub(/File\.read!\(.*?\)/, '"0.0.1"').
    gsub(/File\.read\(.*?\)/, '{:ok, "0.0.1"}').
    gsub(/^\s*config_path:.*(?:,|$)/, "")
end