Created
April 27, 2011 20:00
-
-
Save mattmanning/945051 to your computer and use it in GitHub Desktop.
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 'addressable/uri' | |
def remove_query_param(url, param) | |
uri = Addressable::URI.parse(url) | |
params = uri.query_values | |
params.delete(param) | |
uri.query_values = params | |
uri.to_s | |
end | |
puts remove_query_param('http://search.twitter.com/search.json?&q=twitter&since_id=1520639490&geocode=40.757929%2C-73.985506%2C25km','since_id') | |
# => http://search.twitter.com/search.json?geocode=40.757929%2C-73.985506%2C25km&q=twitter |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment