Ruby/String/Convert to Symbol

Материал из Wiki.crossplatform.ru

Перейти к: навигация, поиск

The value of the string, not its name, becomes the symbol

play = "this is a test".intern



To convert a string into a symbol (Symbol class), use either the to_sym or intern methods

"name".intern # => :name
"name".to_sym # => :name