Two Ruby Memoization Patterns
Two main memoization patterns I’ve seen are the following Example #1 is shorter, however if you stare at it hard enough you’ll realize if @the_thing is supposed to be false or a falsy value then it would never be memoized. Example #2 of checking if the variable has been defined is a more sure method … Read more