to_s()
public
Converts hsh to a string by converting the hash to an array of [ key, value ]
pairs and then converting that array to a string using Array#join with the default separator.
h = { "c" => 300, "a" => 100, "d" => 400, "c" => 300 }
h.to_s
Show source
/*
* call-seq:
* hsh.to_s => string
*
* Converts <i>hsh</i> to a string by converting the hash to an array
* of <code>[</code> <i>key, value</i> <code>]</code> pairs and then
* converting that array to a string using <code>Array#join</code> with
* the default separator.
*
* h = { "c" => 300, "a" => 100, "d" => 400, "c" => 300 }
* h.to_s
*/
static VALUE
rb_hash_to_s(hash)
VALUE hash;
{
if (rb_inspecting_p(hash)) return rb_str_new2("{...}");
return rb_protect_inspect(to_s_hash, hash, 0);
}