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

- old
+ new

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