The class that represents symbols. See Symbol for more information.
Returns the string corresponding to a symbol.
Use String#to_sym to obtain the symbol corresponding to a string.
p :foo.id2name.to_sym == :foo # => true
Returns the integer corresponding to a symbol.
Use Fixnum#to_sym to obtain the symbol corresponding to this integer.
p :foo.to_i # => 8881 p :foo.to_i.to_sym # => :foo
In Ruby, reserved words, variable names, method names, and the like are controlled by these integers. Integers corresponding to objects (obtained via Object#object_id) and those corresponding to symbols are separate items.