Created
March 18, 2015 13:20
-
-
Save ripienaar/110b68855d64a841e1aa to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def parse(url) | |
| res = url.split("//") | |
| temp = res[1] | |
| output = temp.split(":") | |
| username = output[0] | |
| text = output[1] | |
| pos = text.rindex('@') | |
| length = text.length() | |
| password = text[0,pos] | |
| @host = text[pos+1, length] | |
| @user = URI.decode(username) | |
| @password = URI.decode(password) | |
| end |
Author
ripienaar
commented
Mar 18, 2015
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment