Class: Dependabot::Hex::UpdateChecker::RequirementsUpdater

Inherits:
Object
  • Object
show all
Defined in:
lib/dependabot/hex/update_checker/requirements_updater.rb

Constant Summary collapse

OPERATORS =
/>=|<=|>|<|==|~>/.freeze
AND_SEPARATOR =
/\s+and\s+/.freeze
OR_SEPARATOR =
/\s+or\s+/.freeze
SEPARATOR =
/#{AND_SEPARATOR}|#{OR_SEPARATOR}/.freeze

Instance Method Summary collapse

Constructor Details

#initialize(requirements:, latest_resolvable_version:, updated_source:) ⇒ RequirementsUpdater

Returns a new instance of RequirementsUpdater.


16
17
18
19
20
21
22
23
24
25
26
# File 'lib/dependabot/hex/update_checker/requirements_updater.rb', line 16

def initialize(requirements:, latest_resolvable_version:,
               updated_source:)
  @requirements = requirements
  @updated_source = updated_source

  return unless latest_resolvable_version
  return unless Hex::Version.correct?(latest_resolvable_version)

  @latest_resolvable_version =
    Hex::Version.new(latest_resolvable_version)
end

Instance Method Details

#updated_requirementsObject


28
29
30
# File 'lib/dependabot/hex/update_checker/requirements_updater.rb', line 28

def updated_requirements
  requirements.map { |req| updated_mixfile_requirement(req) }
end