class Dependabot::Uv::Version
def initialize(version)
def initialize(version) raise Dependabot::BadRequirementError, "Malformed version string - string is nil" if version.nil? @version_string = version.to_s raise Dependabot::BadRequirementError, "Malformed version string - string is empty" if @version_string.empty? matches = ANCHORED_VERSION_PATTERN.match(@version_string.downcase) unless matches raise Dependabot::BadRequirementError, "Malformed version string - #{@version_string} does not match regex" end @epoch = matches["epoch"].to_i @release_segment = matches["release"]&.split(".")&.map(&:to_i) || [] @pre = parse_letter_version(matches["pre_l"], matches["pre_n"]) @post = parse_letter_version(matches["post_l"], matches["post_n1"] || matches["post_n2"]) @dev = parse_letter_version(matches["dev_l"], matches["dev_n"]) @local = parse_local_version(matches["local"]) super(matches["release"] || "") end