Ruby Language Symbols Converting a Symbol to String


Given a Symbol:

s = :something

The simplest way to convert it to a String is by using the Symbol#to_s method:

# => "something"

Another way to do it is by using the Symbol#id2name method which is an alias for the Symbol#to_s method. But it's a method that is unique to the Symbol class:

# => "something"