Somtetimes you need to know if exactly one element in a collection has a given property. For that situation, we have the #one? predicate method.
Category: Episodes
Episode #043: Exclusive Or
This episode looks at Ruby's logical XOR operator, and how it can be useful in checking that a method was called with the correct optional arguments.
Episode #042: Streaming
Does code optimized for RAM usage need to be ugly? Find out, in today's episode!
Episode #041: String#scan
Today's episode looks at a convenient tool for weeding through text and pulling out parts that match a given pattern.
Episode #040: Gradual Stiffening
In today's episode we'll try to come to grips with a slippery quality---a quality which is of importance to differentiating code that is easy to evolve, from code that isn't. …
Episode #039: Gem Love Part 1
In this, the first of another ongoing occasional series, I revisit an open-source application I started three years ago and begin to rewrite it. Part 1 focuses on building a …
Episode #038: Caller-Specified Fallback
Sometimes it's hard to decide how to handle a failure in a method call. Raise an exception? Return a nil? Log an error? The best choice may differ depending on …
Episode #037: Proc and Threequals
Today's dish combines the great flavor of Ruby's 'case' statement with a little Proc seasoning and a threequals demiglace!
Episode #036: Blocks, Procs, and Lambdas
How is a Proc different from a Lambda? When do you use one over the other? And how to blocks fit into all this? Today's episode attemptes to answer these …