Manage URI Query params in Ruby

February 10th, 2012

How to programatically remove a Query parameter from an URI String in Ruby.Github Octocat by Simon Oxley
For the following URI:

http://example.com/resource?param1=1&param2=2&offset=3

If one wants to remove the “offset” parameter, the following may help.

EDIT: if a left side only param exists, it will be removed. Something like param2 in:
http://example.com/resource?param1=1&param2=&offset=3

(blogged from Vim)