I am enjoying reading Mr. Neighborly’s Humble Little Ruby Book by Jeremy McAnnally. It’s a very easy read. I just finished chapter 3, and even though I’ll likely read the whole thing in the free PDF, I’ve ordered the print version to support this wonderful author and also I expect it will make a handy reference.

Along with the naturally dry instruction on the ins an outs of a programming language which he explains quite well, he includes humourous sample code and makes little language quirks delightfully easy to remember, such as:

For example, if you were creating a roleplaying game and wanted to set the possible ranges for the height of each race (in inches), you could type:

human = 48..81
elf = 40…68
grotesquely_huge_guy = 120..132

Ranges can use either two dots, which indicates an inclusive range of all values including the beginning value and the end value, or three dots, which excludes the last value. This seems backwards at first glance, but in truth that third dot is so fat that it pushes the last element out of the range. I am not kidding; crack open a debugger and find out for yourself.

2 thoughts on “great ruby book

What do you think?