class Dependabot::Uv::UpdateChecker::RequirementsUpdater
def index_to_update_for(req_string)
def index_to_update_for(req_string) req = requirement_class.new(req_string.split(/[.\-]\*/).first) version = req.requirements.first.last.release if req_string.strip.start_with?("^") version.segments.index { |i| i != 0 } elsif req_string.include?("*") version.segments.count - 1 elsif req_string.strip.start_with?("~=", "==") version.segments.count - 2 elsif req_string.strip.start_with?("~") req_string.split(".").count == 1 ? 0 : 1 else raise "Don't know how to convert #{req_string} to range" end end