There’s a lot of complaining, especially from people coming to Ruby from the Java world, about the lack of a language specification. And while a lot of effort is put into the RubySpec project to at least have a test-driven specification, the written word has been silently ignored for a long time. At least in terms of information technology.
There used to be a book called “Ruby in a Nutshell”, written by Matz himself, but it mainly dealt with Ruby 1.6, and is therefore seriously outdated.
David Flanagan (author of several great books on JavaScript and Java) set out to fix that problem. With the help of Matz he dove deep into Ruby and wrote what I can only describe as its only valid written language specification. The result is “The Ruby Programming Language”.
The book doesn’t take any unusual path when it comes to its structure. It deals with the basic structure of a Ruby program, datatypes and objects, expressions, operators, control flow, methods, procs, lambdas, classes, modules and finally, reflection and metaprogramming.
Whatever you consider part of the Ruby language, you’ll be sure to find it in one of those chapters. David manages to get the whole of the language into a mere 300 pages. Both a testament to the compactness of Ruby and David’s skill to explain each part as simple as possible.
You’d expect something like a language specification to be boring (if you don’t, you obviously haven’t read the Java Language Specification or The C++ Programming Language), but I’m happy to report that is not the case. While you shouldn’t expect an entertaining read, you can expect to learn all the little details you somehow have not yet grokked about Ruby. The book finally opened my eyes on the difference of proc and lambda. The book ends with a discussion of the core classes of Ruby, including API changes between 1.8 and 1.9.
It is up-to-date with Ruby 1.8, and includes most of the features of Ruby 1.9 including of course, fibers.
My verdict is simple: If you work with Ruby, buy this book. It’s pretty much the most complete book on Ruby you’ll find. While “The Ruby Way” is an excellent reference “The Ruby Programming Language” is meant as a guide through the language. You can read it once, and get back to it when you need to. And seriously: You should read it. There’s very likely some parts of Ruby you haven’t worked with in all detail yet. This book does a good job in helping you uncover them.
Disclaimer: O’Reilly provided me with a copy of the book for reviewing purposes. My excitement about it is real.