As a Ruby programmer, you already know how much fun it is. Now see how to unleash its power, digging under the surface and exploring the language’s most advanced features: a collection of techniques and tricks known as metaprogramming. Once the domain of expert Rubyists, metaprogramming is now accessible to programmers of all levels—from beginner to expert. Metaprogramming Ruby explains metaprogramming concepts in a down-to-earth style and arms you with a practical toolbox that will help you write great Ruby code.
Metaprogramming Ruby: Program Like the Ruby Pros
by Paolo Perrotta
Metaprogramming Ruby 2 is available here.
About This Book
Everyone in the Ruby world seems to be talking about metaprogramming—how you can use it to remove duplication in your code and write elegant, beautiful programs. Now you can get in on the action as well.
This book describes metaprogramming as an essential component of Ruby. Once you understand the principles of Ruby, including the object model, scopes, and eigenclasses, you’re on your way to applying metaprogramming both in your daily work and in your fun, after-hours projects.
Learning metaprogramming doesn’t have to be difficult or boring. By taking you on a Monday-through-Friday workweek adventure with a pair of programmers, Paolo Perrotta helps make mastering the art of metaprogramming both straightforward and entertaining.
The book is packed with:
- Pragmatic examples of metaprogramming in action, many of which come straight from popular libraries or frameworks, such as Rails.
- Programming challenges that let you experiment and play with some of the most fun, “out-there” metaprogramming concepts.
- Metaprogramming spells—34 practical recipes and idioms that you can study and apply right now, to write code that is sure to impress.
Whether you’re a Ruby apprentice on the path to mastering the language or a Ruby wiz in search of new tips, this book is for you.
Read the reviews .
What You Need
Ruby 1.8 or Ruby 1.9
Each of our books has its own dedicated discussion area, where readers help each other out. Many authors also choose to drop by.
Here are some recent topics:
Contents & Extracts
- Metaprogramming Ruby
- Monday: The Object Model
- Tuesday: Methods excerpt
- Wednesday: Blocks
- Thursday: Class Definitions
- Friday: Code That Writes Code
- Metaprogramming in Rails
- The Design of ActiveRecord
- Inside ActiveRecord
- Metaprogramming Safely
- Common Idioms
- Domain Specific Languages
- Spell Book excerpt
Brought to You By
Paolo Perrotta has more than ten years of experience as a developer and writer. He worked for domains ranging from embedded to enterprise software, computer games, and web applications. These days, Paolo coaches agile teams for Yoox, a large Internet fashion shop, and teaches Java to developers throughout Europe. He lives in Bologna, Italy, with his girlfriend and a cat. He loves Ruby.