Ruby gives as a number of options when it comes to defining class methods. This episode starts by demonstrating three of them, and then gets a bit opinionated.
Month: April 2013
Episode #089: Coincidental Duplication
The DRY principle teaches us to get rid of duplication wherever we find it. But not all duplication is created equal...
Episode #088: Gem Love Part 5
In this continuation of the Gem-Love project, I complete the end-to-end acceptance test, verifying that the client can talk to the server. Source code here: https://github.com/avdi/gem-love/tree/rubytapas-088 Just a reminder, I'm collecting …
Episode #087: Naming Things: Headcount
Naming things is hard, and it's difficult to come up with hard-and-fast rules for it. But it can be helpful to learn from examples of real-world naming decisions that led …
Episode #086: Naked Splat
In this episode we tackle how to override base class methods while cleanly passing through multiple base-class arguments. Notes: Paul Battley on Destructuring Assignment in Ruby
Episode #085: Ignore Arguments
Sometimes a block or method may receive arguments that you just don't care about. This episode introduces the idiomatic Ruby way to indicate that certain arguments should be ignored.
Episode #084: Splat Group
Today we take a look at a related feature to Ruby's "splat" operator: the ability to recursively destructure arrays using grouped assignment.
Episode #083: Custom Splat
In today's episode we discover how to make an arbitrary object implicitly "splat"-able.
Episode #082: Inline Assignment
It's a small thing, but judicious use of inline assignment can make code more DRY and concise. In this episode we look at how to do it, and when.