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

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

Constant Summary collapse

FILE_READ =
/File.read\(.*?\)/.freeze
FILE_READ_BANG =
/File.read!\(.*?\)/.freeze
PIPE =
Regexp.escape("|>").freeze
VERSION_FILE =
/"VERSION"/i.freeze
NESTED_VERSION_FILE_READ =
/String\.trim\(#{FILE_READ}\)/.freeze
NESTED_VERSION_FILE_READ_BANG =
/String\.trim\(#{FILE_READ_BANG}\)/.freeze
PIPED_VERSION_FILE_READ =
/#{VERSION_FILE}[[:space:]]+#{PIPE}[[:space:]]+#{FILE_READ}/.freeze
PIPED_VERSION_FILE_READ_BANG =
/#{VERSION_FILE}[[:space:]]+#{PIPE}[[:space:]]+#{FILE_READ_BANG}/.freeze

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


26
27
28
29
30
# File 'lib/dependabot/hex/file_updater/mixfile_sanitizer.rb', line 26

def sanitized_content
  mixfile_content.
    yield_self(&method(:prevent_version_file_loading)).
    yield_self(&method(:prevent_config_path_loading))
end