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

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

Constant Summary collapse

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

Instance Method Summary collapse

Constructor Details

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

Returns a new instance of RequirementsUpdater.



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

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



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

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