module OpenGit::Github
Public Class Methods
parse(link)
click to toggle source
# File lib/open_git/github.rb, line 6 def self.parse(link) re = /^((git@)|(https?:\/\/))(.*)[\/:]([^:\/]*)\/([^:\/]*)\.git$/ match = re.match(link) raise OpenGit::Github::InvalidLinkError unless match return { protocol: if match[2] "ssh" elsif match[3] == "https://" "https" elsif match[3] == "http://" "http" end, domain: match[4], org: match[5], repo: match[6] } end