Be prepared, this is an unconventional Ruby book. To use author's words:
This is a book about making that final leap, about absorbing the Ruby programming culture, about becoming truly fluent in Ruby. You need to absorb the cultural part of Ruby, to see how real Rubyist use the language to solve problems.
Learning Ruby is not difficult, start thinking in Ruby and becoming a Rubyist is the real challenge.
The book is divided into 4 parts. Each part is divided into chapters. The book counts 31 chapters and about 400 pages.
- The Basics
- Classes, Modules, and Blocks
- Pulling It All Together
The first part covers some basic Ruby features in a way you normally won't read in any other Ruby reference. Ah, if I only had the Symbol chapter available when I started learning Ruby!
The second part covers Classes, Modules and Blocks and it explains how to use modules successfully, how to deal with inheritance, equality and operators. This is by far my most favorite section.
The third part is about Metaprogramming. Whilst the name of the section is technically correct, it can be misleading. If you are looking for a complete Ruby and Metaprogramming course, check out Metaprogramming Ruby (US | UK). This section covers common Ruby metaprogramming topic such as hooks, method_missing (a must read!) and monkey patching.
The fourth part wraps several topics all together and talks about creating and implementing a DSL in Ruby.
The book ends with a rich list of books about Ruby and programming in general. The list contains amazing Ruby titles like Ruby Best Practices (US | UK) or The Ruby Way Second Edition (US | UK), as well programming masterpieces like The Elements of Programming Style (US | UK). If you are looking for some inspiration about your next reading, you might probably find some there.
This book assumes that you have a basic knowledge of the Ruby language. You don't need to be a Ruby master, but some advanced sections such as Metaprogramming and DSL may require you to stop for a moment and refresh or improve your specific knowledge of Ruby on that topic.
Don't expect this book to explain you the basic details of Ruby or its syntax, this is behind the scope of this publication. There are plenty of commented examples, but if you want to learn about a specific Ruby feature make sure you keep a reference like Programming Ruby or The Ruby Way handy.
Be ready to read printed source code: this book is full or Ruby code. At least the 50% of the pages contain code, making this book a valuable practical reference.
Eloquent Ruby is a very lightweight and pleasant reading. The colloquial tone is friendly and engrossing. The books has plenty of code snippets and it requires only a few days to read it from start to end.
Aside from being an excellent resource to help you thinking Ruby and programming in the Ruby way, this book constantly adopts a practical approach providing tons of examples to read. Every chapter ends with an In the Wild section containing examples extracted from real Ruby libraries, and a Wrapping up section that helps you to fix the concepts in mind.
I appreciated the focus on tests and the RSpec chapter. The most part of the examples are verified by tests, and the tests are also available in the book.
I found the Regular Expression chapter pretty boring and misplaced. In fact, it was the only chapter in the book where the main focus was teaching Regular Expression basics, instead of focusing on using Regular Expressions in the right way.
I would have left the RubyGems section outside the book. There have been several changes in the Gems community in the last years and the chapter appears to be slightly outdated.
A wider usage of Ruby 1.9 over Ruby 1.8 in the examples would be preferred, in order to discourage the adoption of Ruby 1.8.
Who should read it?
If you are a beginner to intermediate level Ruby programmer, this book is a must read that it's likely to help you improving your Ruby skill and writing code in the Ruby way.
If you are completely new to Ruby, I don't recommend to start with this. Approach the language by reading a "programming with Ruby" book, then read Eloquent Ruby to learn how to program in the Ruby way.
If you are a Ruby expert and you have been writing Ruby for the last 5 years, don't be too self-confident. I'm quite sure the book will be able to provide you some valuable advice.