The intricacies of implementing memoization in Ruby