module StillActive::Repository

Constants

GITHUB_REGEX
GITLAB_REGEX
HASH_KEYS

Public Instance Methods

url_with_owner_and_name(url:) click to toggle source
# File lib/still_active/repository.rb, line 19
def url_with_owner_and_name(url:)
  [GITHUB_REGEX, GITLAB_REGEX].each do |regex|
    values = url&.scan(regex)&.first
    next if values.nil? || values.empty?

    return HASH_KEYS.zip(values).to_h
  end
  { source: :unhandled, owner: nil, name: nil }
end
valid?(url:) click to toggle source
# File lib/still_active/repository.rb, line 13
def valid?(url:)
  [GITHUB_REGEX, GITLAB_REGEX].any? do |regex|
    !url.scan(regex)&.first.nil?
  end
end