lib/active_memoize/cache.rb in active_memoize-1.0.3 vs lib/active_memoize/cache.rb in active_memoize-1.1.0

- old
+ new

@@ -51,12 +51,12 @@ def merge!(hash) @cache.merge!(hash) end - def memoize(&block) + def memoize(method_name = nil, &block) method_locals = caller_locals(block) - method_name = caller_method + method_name ||= caller_method method_name = "#{caller_method}:#{method_locals}" unless method_locals.nil? return @cache[method_name] if @cache.key?(method_name) @cache[method_name] = yield(block)