Skip to content

Instantly share code, notes, and snippets.

@jbrechtel
Created May 24, 2017 20:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jbrechtel/24aa2cecb208d3d6768e11446e3bc6d8 to your computer and use it in GitHub Desktop.
Save jbrechtel/24aa2cecb208d3d6768e11446e3bc6d8 to your computer and use it in GitHub Desktop.
Why Ruby's URI join sucks.
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