title: Ruby: how to decorate a method with memoization?
body: <p>Suppose I have a class in Ruby:</p>
  
  <pre><code>class Test
    def method(arg1, arg2)
      return arg1+arg2
    end
  
    memoize :method
  end
  </code></pre>
  
  <p>And I want to memoize its results. So for debug purposes I modified the class like this:</p>
  
  <pre><code>class Test
    def method(arg1, arg2)
      puts 'sth to make sure the method was executed'
      return arg1+arg2
    end
    ...
  end
  </code></pre>
  
  <p>And wrote a test that calls the method with same args, to see what get's outputted... and well the method is not memoized. What's the correct way to do this?</p>