In this final installment on the #fetch method we look at #fetch beyond Hash; #fetch with nested hashes; re-using default blocks; and more.
Tag: containers
Episode #012: #fetch for Defaults
How to use Hash#fetch to provide defaults for missing keys, and why you might prefer that to other techniques for defaulting values.
Episode #008: #fetch as an Assertion
Hash#fetch is one of my favorite methods. In this episode, I take a look at using it to assert the existence of hash keys.