Symbol

The class that expresses symbols. See Symbol for more information.

Superclass

Methods

id2name

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
to_i

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.

Converted from CHM to HTML with chm2web Pro 2.85 (unicode)