-
-
Save havenwood/bb3f0dfd24dcbfbf1348 to your computer and use it in GitHub Desktop.
irc url
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' | |
=> true | |
>> url = URI.parse 'http://anyurl.com?value=placeholder' | |
=> #<URI::HTTP:0x007f9d25694ed8 URL:http://anyurl.com?value=placeholder> | |
>> url.scheme | |
=> "http" | |
>> url.host | |
=> "anyurl.com" | |
>> url.query | |
=> "value=placeholder" | |
>> new_url = "#{url.scheme}://#{url.host}?#{url.query.sub('placeholder', 'new_value')}" | |
=> "http://anyurl.com?value=new_value" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment