Monday, May 08, 2006 1:24 PM
by
dodyg
Symbols aren't Strings
Symbol is one of those Ruby concept that is hard to grok for C# programmers. It's a name for object (what ?)
Read this good explanation about what a symbol is (because Ruby help file is useless on this topic)
"You can’t ask for the size of a symbol. You can’t ask for a substring of the
symbol. You can’t do anything that you can do with strings on Symbols except (1)
convert it to an integer (using
to_i) and (2) convert it to a
symbol (using
to_sym). If a symbol is not a duck-type for a String,
it hardly seems reasonable to call Symbols any kind of String, even immutable
ones." (
onestepback)