class Dependabot::Source

def self.from_url(url_string)

def self.from_url(url_string)
  return github_enterprise_from_url(url_string) unless url_string&.match?(SOURCE_REGEX)
  captures = T.must(url_string.match(SOURCE_REGEX)).named_captures
  new(
    provider: T.must(captures.fetch("provider")),
    repo: T.must(captures.fetch("repo")).delete_suffix(".git").delete_suffix("."),
    directory: captures.fetch("directory"),
    branch: captures.fetch("branch")
  )
end