Created
May 24, 2017 20:27
-
-
Save jbrechtel/24aa2cecb208d3d6768e11446e3bc6d8 to your computer and use it in GitHub Desktop.
Why Ruby's URI join sucks.
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
require 'uri' | |
base = 'http://google.com' | |
foo = 'foo' | |
bar = 'bar' | |
puts URI::join(base, foo) | |
puts URI::join(base, foo, bar) | |
puts URI::join(URI::join(base, foo), bar) | |
#output is | |
#http://google.com/foo | |
#http://google.com/bar | |
#http://google.com/bar |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment