Cache the result of the methods.
include Memoizable def foo ...... end def bar(a, b) ...... end memoize :foo, :bar(a, b)
To clear cache, clear_foo, clear_bar is also defined.
(NOTE)
Consider to use this with huge objects to avoid memory leaks.
Can’t use this with super.<method> because of infinity loop.
# File lib/locale/util/memoizable.rb, line 55 def memoize(*symbols) memoize_impl(false, *symbols) end
Generated with the Darkfish Rdoc Generator 2.