# File lib/facets/core/module/memoize.rb, line 26 def memoize(*meths) @_MEMOIZE_CACHE ||= Hash.new meths.each do |meth| mc = @_MEMOIZE_CACHE[meth] = Hash.new old = instance_method(meth) new = proc do |*args| if mc.has_key? args mc[args] else mc[args] = old.bind(self).call(*args) end end send(:define_method, meth, &new) end end