struct Symbol

Overview

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.

Included Modules

Defined in:

core_ext/symbol.cr

Class Method Summary

Instance Method Summary

Instance methods inherited from module BSON::Value

bson_size bson_size, to_bson to_bson

Class Method Detail

def self.from_bson(bson : IO) #

[View source]

Instance Method Detail

def to_bson(bson : IO) #

[View source]