Module: Padrino::Utils
Instance Method Summary
-
#build_uri_query(object, namespace = nil) ⇒ Object
Builds an URI query from a Hash or any Object. -
#deep_dup(object) ⇒ Object
Recursively duplicates the passed object. -
#symbolize_keys(hash) ⇒ Object
Returns a Hash with keys turned into symbols.
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"
#deep_dup(object) ⇒ Object
Recursively duplicates the passed object.
#symbolize_keys(hash) ⇒ Object
Returns a Hash with keys turned into symbols.
© 2010–2020 Padrino
Licensed under the MIT License.
https://www.rubydoc.info/github/padrino/padrino-framework/Padrino/Utils