End of Life Ruby 3.0 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →
instance method
Symbol#to_s
sym.to_s → string
string.c
View on GitHub ↗
VALUE
rb_sym_to_s(VALUE sym)
{
return str_new_shared(rb_cString, rb_sym2str(sym));
}
Returns the name or string corresponding to sym.
Example
: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.