Recommended to me by: Sam Livingston-Gray
This book conveys tips, tricks, and cautions in a conversational style without talking down to the reader. Several topics became immediately useful when I recognized them in the code at work the next day.
Some of Ruby’s oddities, I mean special features, are:
- No static type-checking. Pass any object as an argument to a method, and if it answers to the methods called on it, all is well. This is formally known as “duck typing,” as in “if it looks like a duck, and quacks like a duck…”
- Pass anonymous blocks to functions. For example Array.each will call a block on each element of an array.
- Add/change/delete methods in classes at runtime.
- Mix in new functionality by including modules in a class.
- Override method_missing to extend a class on the fly. This is considered a “standard” trick.
Highly recommended if you’re programming in Ruby. I’d read Russ Olsen’s writing on any topic based on the quality of this book.
Leave a Reply