HEX
Server: Apache
System: Linux sxb1plzcpnl440011.prod.sxb1.secureserver.net 4.18.0-553.54.1.lve.el8.x86_64 #1 SMP Wed Jun 4 13:01:13 UTC 2025 x86_64
User: xfp2mtarcm67 (7705020)
PHP: 7.3.33
Disabled: NONE
Upload Files
File: //opt/alt/ruby32/share/gems/doc/rest-client-2.1.0/ri/RestClient/Utils/encode_query_string-c.ri
U:RDoc::AnyMethod[iI"encode_query_string:ETI"+RestClient::Utils::encode_query_string;TT:publico:RDoc::Markup::Document:@parts[.o:RDoc::Markup::Paragraph;	[I"?Serialize a ruby object into HTTP query string parameters.;To:RDoc::Markup::BlankLineo;
;	[I"HThere is no standard for doing this, so we choose our own slightly ;TI"Oidiosyncratic format. The output closely matches the format understood by ;TI"Rails, Rack, and PHP.;T@o;
;	[I"KIf you don't want handling of complex objects and only want to handle ;TI"Lsimple flat hashes, you may want to use `URI.encode_www_form` instead, ;TI"<which implements HTML5-compliant URL encoded form data.;T@o;
;	[I"=@param [Hash,ParamsArray] object The object to serialize;T@o;
;	[I"J@return [String] A string appropriate for use as an HTTP query string;T@o;
;	[I"@see {flatten_params};T@o;
;	[I"@see URI.encode_www_form;T@o;
;	[I"4@see See also Object#to_query in ActiveSupport ;TI"@@see http://php.net/manual/en/function.http-build-query.php;To:RDoc::Markup::Verbatim;	[I"http_build_query in PHP
;T:@format0o;
;	[I"9@see See also Rack::Utils.build_nested_query in Rack;T@o;
;	[I"?Notable differences from the ActiveSupport implementation:;T@o:RDoc::Markup::List:
@type:BULLET:@items[o:RDoc::Markup::ListItem:@label0;	[o;
;	[I"MEmpty hash and empty array are treated the same as nil instead of being ;TI"Komitted entirely from the output. Rather than disappearing, they will ;TI"appear to be nil instead.;T@o;
;	[I"MIt's most common to pass a Hash as the object to serialize, but you can ;TI"Malso use a ParamsArray if you want to be able to pass the same key with ;TI"Amultiple values and not use the rack/rails array convention.;T@o;
;	[I"@since 2.0.0;T@o;
;	[I"@example Simple hashes;To;;	[I"2>> encode_query_string({foo: 123, bar: 456})
;TI"=> 'foo=123&bar=456'
;T;
0o;
;	[I"@example Simple arrays;To;;	[I",>> encode_query_string({foo: [1,2,3]})
;TI""=> 'foo[]=1&foo[]=2&foo[]=3'
;T;
0o;
;	[I"@example Nested hashes;To;;	[I";>> encode_query_string({outer: {foo: 123, bar: 456}})
;TI"(=> 'outer[foo]=123&outer[bar]=456'
;T;
0o;
;	[I"@example Deeply nesting;To;;	[I"F>> encode_query_string({coords: [{x: 1, y: 0}, {x: 2}, {x: 3}]})
;TI"B=> 'coords[][x]=1&coords[][y]=0&coords[][x]=2&coords[][x]=3'
;T;
0o;
;	[I"#@example Null and empty values;To;;	[I"J>> encode_query_string({string: '', empty: nil, list: [], hash: {}})
;TI""=> 'string=&empty&list&hash'
;T;
0o;
;	[I"@example Nested nulls;To;;	[I"=>> encode_query_string({foo: {string: '', empty: nil}})
;TI""=> 'foo[string]=&foo[empty]'
;T;
0o;
;	[I"B@example Multiple fields with the same name using ParamsArray;To;;	[I"\>> encode_query_string(RestClient::ParamsArray.new([[:foo, 1], [:foo, 2], [:foo, 3]]))
;TI"=> 'foo=1&foo=2&foo=3'
;T;
0o;
;	[I" @example Nested ParamsArray;To;;	[
I"T>> encode_query_string({foo: RestClient::ParamsArray.new([[:a, 1], [:a, 2]])})
;TI"=> 'foo[a]=1&foo[a]=2'
;TI"
;TI"[>> encode_query_string(RestClient::ParamsArray.new([[:foo, {a: 1}], [:foo, {a: 2}]]))
;TI"=> 'foo[a]=1&foo[a]=2';T;
0:
@fileI"lib/restclient/utils.rb;T:0@omit_headings_from_table_of_contents_below000[I"
(object);T@~FI"
Utils;TcRDoc::NormalModule00