Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def from(str)
- case str.split("/")
- in [name] then "github.com/#{name}/#{name}"
- in [owner, name] then "github.com/#{owner}/#{name}"
- in [host, owner, name] then "#{host}/#{owner}/#{name}"
- end
- end
- puts from("name")
- # => github.com/name/name
- puts from("owner/name")
- # => github.com/owner/name
- puts from("github.com/owner/name")
- # => github.com/owner/name
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement