In this episode we create a function for converting arbitrary values into Feet objects.
Tag: idioms
Episode #173: For
Newer arrivals to Ruby sometimes wonder when to use #each, and when to use 'for'. Today, a detailed explanation of how they differ, and an opinion on when to use …
Episode #166: Not Implemented
Ruby doesn't have a built-in concept of "abstract" classes, but sometimes we want a way to show other programmers when methods are left as an exercise for the implementor. This …
Episode #119: Intention Revealing Argument
Some techniques for making boolean flag arguments read more meaningfully.
Episode #111: Symbol Placeholder
Nobody wants to debug an "undefined method for NilClass" error. Today's episode shows a little trick for making these errors more meaningful.
Episode #101: Intention Revealing Message
Not all refactoring is about eliminating duplication. In today's episode we'll refactor some code for the purpose of revealing intent to future readers.
Episode #094: Bang Bang
Have you ever found yourself looking for a '#to_bool' method in Ruby? This episode explores why boolean conversion isn't needed as often as you might think; as well as how …
Episode #090: class<<self
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.
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.