Metaprogramming in Ruby 2: Program Like the Ruby Pros by Paolo Perrotta is delightful book on the advanced aspects of the Ruby language. It’s very approachable and written in a way that delights the user to follow along with examples and practicing in their own IRB or Rails console. The first time I read it, I couldn’t help but try the examples myself as I was reading along. Paolo writes them in a concise manner that’s easy to understand and truly captures the essence of the message.
Metaprogramming is explained as code that writes code, which also happens to be a great way to learn Ruby’s thoughtful and nuanced design implications. While it is entirely possible to get proficient with Ruby on Rails and develop applications without the lessons found in Metaprogramming in Ruby 2, but it would be difficult to find a better book to deepen those skills. Ruby on Rails’ strong conventions and focus on developer happiness is in no small part possible because of Ruby’s unique language features. Rails takes advantage of Ruby’s introspection, open classes (aka monkeypatching), methods design, inclusion of blocks, dynamic programming techniques to fulfill it’s promise of developer happiness, and convention over configuration.
If you’re looking for a way to level up your Ruby and Rails skills, you would be hard pressed to find a better book. I highly recommend it.