class QB::GitHub::RepoID
Unique identifier for a GitHub repo, which is a composite of an `owner` and a `name` string.
Public Instance Methods
git_https_url()
click to toggle source
HTTPS protocol URL string for use as a Git remote.
@example
repo_id = QB::GitHub::RepoID.new owner: 'nrser', name: 'qb' repo_id.git_https_url # => "https://github.com/nrser/qb.git"
@return [String]
# File lib/qb/github/repo_id.rb, line 106 def git_https_url "https://github.com/#{ path }.git" end
git_ssh_url()
click to toggle source
SSH protocol URL string for use as a Git remote.
@example
repo_id = QB::GitHub::RepoID.new owner: 'nrser', name: 'qb' repo_id.git_ssh_url # => "git@github.com:nrser/qb.git"
@return [String]
# File lib/qb/github/repo_id.rb, line 92 def git_ssh_url "git@github.com:#{ path }.git" end
git_url(protocol)
click to toggle source
Return {#git_ssh_url} or {#git_https_url} depending on `protocol` parameter.
@param [Symbol] protocol
`:ssh` or `:https`.
@return [String]
URL.
# File lib/qb/github/repo_id.rb, line 120 def git_url protocol t.match protocol, :ssh, ->( _ ) { git_ssh_url }, :https, ->( _ ) { git_https_url } end
path()
click to toggle source
“Path” on GitHub for the repo - the `<owner>/<name>` part that comes after the host in URLs.
Called `full_name` in GitHub API (we include a `#full_name` method alias as well).
This is also what we return for {#to_s}.
@example
repo_id = QB::GitHub::RepoID.new owner: 'nrser', name: 'qb' repo_id.path # => "nrser/qb"
@return [String]
# File lib/qb/github/repo_id.rb, line 75 def path "#{ owner }/#{ name }" end