-
-
Save slyphon/1340992 to your computer and use it in GitHub Desktop.
Appending a path to a URI
This file contains 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' | |
s1 = "http://storage.blah.com/auth28173" | |
s2 = "/container/path/to/object" | |
u = URI.parse(s1) | |
ary = s2.split('/') | |
ary.shift if ary[0].empty? | |
u.path = [u.path.split('/'), ary].flatten.join('/') | |
puts u | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment