W3cubDocs

/Padrino

Module: Padrino::Utils

Extended by:
Utils
Included in:
Utils

Instance Method Summary

Instance Method Details

#build_uri_query(object, namespace = nil) ⇒ Object

Builds an URI query from a Hash or any Object.

Examples (~ marks here that output is actually escaped by CGI):

Utils.build_uri_query(:a => 1, :b => 2)           #=> "a=1&b=2"
Utils.build_uri_query(:a => [1, 2])               #=> ~"a[]=1&a[]=2"
Utils.build_uri_query([1, 2], 'namespace')        #=> ~"namespace[]=1&namespace[]=2"
Utils.build_uri_query(:a => { :d => 2 }, :b => 3) #=> ~"a[d]=2&b=3"

© 2010–2016 Padrino
Licensed under the MIT License.
http://www.rubydoc.info/github/padrino/padrino-framework/Padrino/Utils