lib/monkeysupport/memoizable.rb in burke-monkeysupport-0.0.4 vs lib/monkeysupport/memoizable.rb in burke-monkeysupport-0.0.7
- old
+ new
@@ -1,11 +1,12 @@
module MonkeySupport
module Memoizable
- # This is faster than AS::Memoizeable
+ # This is faster than AS::Memoizeable.
+ # Less featureful, however.
def monkey_memoize(*methods)
methods.each do |method|
- class_eval( <<"END"
+ class_eval <<EOS
@__#{method} = {}
alias_method :__#{method}, :#{method}
if method(:#{method}).arity == 1
@@ -20,11 +21,10 @@
@__#{method}[args] ||= __#{method}(*args)
end
end
-END
-)
+EOS
end
end
end
end