Module URI
In: lib/more/facets/uri.rb

Methods

Classes and Modules

Module URI::Hash
Module URI::Kernel

Public Instance methods

TODO: How does this compare to URI.escape?

Removes the query string from a uri

Input: the uri

Output: the chomped uri.

Decode the uri components.

This method returns the query string of a uri

Input: the uri

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

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

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

Input: the query string

Output: hash of parameters, contains arrays for multivalued parameters (multiselect, checkboxes , etc) If no query string is provided (nil or "") returns an empty hash.

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

Input: the uri to filter (String) hash of parameters to update

Output: the full updated query string

TODO: optimize

TODO: find a better name. 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.

[Validate]