I hadn’t quite grokked symbols in ruby for some reason. Somehow the definition from the PickAxe book wasn’t quite clear enough:
A Ruby symbol is an identifier corresponding to a string of characters, often a name.
OK, I can see that but what’s the point. Then playing around on Why’s 15 minute browser intro to ruby on the ruby language site I came across this definition:
When you place a colon in front of a simple word, you get a symbol. Symbols are cheaper than strings (in terms of computer memory.) If you use a word over and over in your program, use a symbol. Rather than having thousands of copies of that word in memory, the computer will store the symbol only once.
I like Why’s explanation of the why to use a symbol.