Module: OpenGit::Github
- Defined in:
- lib/open_git/github.rb
Defined Under Namespace
Classes: InvalidLinkError
Class Method Summary collapse
Class Method Details
.parse(link) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# 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 |