Ruby Newbie homepage Ruby Newbie homepage

How to use

Quick guide

Official content
Returns the name or string corresponding to sym.
:fred.id2name   #=> "fred"
:ginger.to_s    #=> "ginger"
Note that this string is not frozen (unlike the symbol itself). To get a frozen string, use name.
 
               VALUE
rb_sym_to_s(VALUE sym)
{
    return str_new_shared(rb_cString, rb_sym2str(sym));
}
            

Was this page useful?