Module | URI
In: | lib/standard/facets/uri.rb

### Methods

cgi_escape cgi_parse cgi_unescape chomp_query_string decode get_query_string hash_to_query hash_to_query_string query_string_to_hash query_to_hash update_query_string update_request_uri

### Classes and Modules

Module URI::Hash
Module URI::Kernel

### Constants

KEY_VALUE_SEPARATOR | = | ";" |  |

### Public Instance methods

cgi_escape(string)

CGI escape

TODO: How does this compare to URI.escape?

cgi_parse(query)
cgi_unescape(string)
chomp_query_string(uri)

Removes the query string from a `uri`.

Returns the chomped uri.

decode(uri)

Decode the uri components.

get_query_string(uri)

This method returns the query string of a uri

Input: the uri

Output: the query string. returns nil if no query string

hash_to_query(parameters)

Given a hash with parameter/value pairs construct a standard query string.

      URI.hash_to_query(:a => 1, :b => 2)
      #=> "a=1;b=2"

hash_to_query_string(parameters)

Alias for hash_to_query

query_string_to_hash(query_string)

Alias for query_to_hash

query_to_hash(query_string)

Extend the basic query string parser provided by the cgi module. converts single valued params (the most common case) to objects instead of arrays

Returns hash of parameters, contains arrays for multivalued parameters (multiselect, checkboxes , etc).

If no query string is provided (nil or "") returns an empty hash.

update_query_string(uri, parameters)

Get a uri and a hash of parameters. Inject the hash values as parameters in the query sting path. Returns the full uri.

uri - the uri to filter (String) parameter - hash of parameters to update

Returns the full updated query string.

TODO: optimize

update_request_uri(request, parameters)

Gets the request uri, injects extra parameters in the query string and returns a new uri. The request object is not modified. There is always a qs string so an extra test is skipped.

TODO: find a better name?

[Validate]