The Ruby Cookbook Official Unofficial Homepage

Jolt Awards nominee!

"Programmers don't live by language syntax alone, but by every line of concrete code they write. To that end, this book is filled with practical recipes, tips, knowledge, and wisdom. I hope it leads readers to the next step of Ruby programming."
--Matz
You think they're the traditionally mundane recipes, but nope, it's all slathered in hollandaise. Oh, man, the examples: adhoc versioning systems, bittorrent clients and ads for your lost dinosaur. The protocols chapter is just good fun. Sticky, sweet nectar will be running off your face! Yes, and some sizeable bacon.
--why
"I've lost count of the times I've googled for ages for some ruby trick and found it in the Cookbook in about 10 seconds."
--Ashley Moran

More raves for the Ruby Cookbook!

Hello, this is Leonard Richardson, and you're about to experience the Ruby Cookbook. (Get it from O'Reilly, Amazon, B&N, or Powell's).

The work of myself, Lucas Carlson, and about twenty contributors, this book covers all aspects of Ruby (see the outline below). We devote ten chapters to general topics like data structures, algorithms, and metaprogramming. We devote five to network applications and closely related topics, including chapters on Rails, databases, and XML/HTML. We cover the tools that Ruby provides to improve your programs: unit tests, performance analysis, Rake, and Rubygems. We also cover thread and process management, C extensions, GUI and console applications.

We hope people will find this book a better reference than O'Reilly's Perl and Python Cookbooks. It contains about 100 more recipes than a typical first edition Cookbook.

Source Code

I've made available a zip file containing all the code in the Ruby Cookbook, one file per recipe.

The Outline

This is the official outline for the book. Each recipe and chapter intro is given a "confidence score" and color-coded. The confidence scores are meaningless in any absolute sense, but you can compare them to each other to see which recipes got the most coverage.

A word about the tests: we have a script that parses the recipes, runs the code samples in an instrumented irb session, and compares the results against what it says in the book. The script can't replace a human looking at the results (a test might "fail" because it involves something like current time, and some recipes can't be automatically tested at all), but it makes it a lot easier to see if there are problems with the code.