struct

Symbol

Inherits Comparable / Value / Object

A symbol is a constant that is identified by a name without you having to give it a numeric value.

:hello
:welcome
:"123"
:"symbol with spaces"

See Symbol literals in the language reference.

Internally a symbol is represented as an Int32, so it's very efficient.

You can't dynamically create symbols. When you compile your program, each symbol gets assigned a unique number.

Instance methods

==(other : Symbol)

Returns true if self is equal to other.

Source
==(other)

Returns false.

Source
to_s

Returns the symbol's name as a String.

:foo.to_s           # => "foo"
:"hello world".to_s # => "hello world"
Source