Class: Dependabot::Elm::UpdateChecker::RequirementsUpdater
- Inherits:
-
Object
- Object
- Dependabot::Elm::UpdateChecker::RequirementsUpdater
- Extended by:
- T::Sig
- Defined in:
- lib/dependabot/elm/update_checker/requirements_updater.rb
Constant Summary collapse
- RANGE_REQUIREMENT_REGEX =
/(\d+\.\d+\.\d+) <= v < (\d+\.\d+\.\d+)/- SINGLE_VERSION_REGEX =
/\A(\d+\.\d+\.\d+)\z/
Instance Method Summary collapse
-
#initialize(requirements:, latest_resolvable_version:) ⇒ RequirementsUpdater
constructor
A new instance of RequirementsUpdater.
- #updated_requirements ⇒ Object
Constructor Details
#initialize(requirements:, latest_resolvable_version:) ⇒ RequirementsUpdater
Returns a new instance of RequirementsUpdater.
24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/dependabot/elm/update_checker/requirements_updater.rb', line 24 def initialize(requirements:, latest_resolvable_version:) @requirements = T.let(requirements, T::Array[T::Hash[Symbol, T.nilable(String)]]) return unless latest_resolvable_version return unless version_class.correct?(latest_resolvable_version) @latest_resolvable_version = T.let( version_class.new(latest_resolvable_version), T.nilable(Dependabot::Version) ) end |
Instance Method Details
#updated_requirements ⇒ Object
37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/dependabot/elm/update_checker/requirements_updater.rb', line 37 def updated_requirements return requirements unless latest_resolvable_version requirements.map do |req| updated_req_string = update_requirement( req[:requirement], latest_resolvable_version ) req.merge(requirement: updated_req_string) end end |