Skip to content

Instantly share code, notes, and snippets.

@garrow
Created March 20, 2012 05:20
Show Gist options
  • Save garrow/2131636 to your computer and use it in GitHub Desktop.
Save garrow/2131636 to your computer and use it in GitHub Desktop.
URI::parse
[65] pry(main)> ftp_abc = 'ftp://www.abc.net.au/hifive/'
=> "ftp://www.abc.net.au/hifive/"
[66] pry(main)> http_abc = 'http://www.abc.net.au/hifive/'
=> "http://www.abc.net.au/hifive/"
[67] pry(main)> f = URI::parse ftp_abc
=> #<URI::FTP:0x7ffe21b416b8 URL:ftp://www.abc.net.au/hifive/>
[68] pry(main)> h = URI::parse http_abc
=> #<URI::HTTP:0x7ffe21b37c58 URL:http://www.abc.net.au/hifive/>
[69] pry(main)> f.path
=> "hifive/"
[70] pry(main)> h.path
=> "/hifive/"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment