lib/picky/helpers/cache.rb in picky-0.12.3 vs lib/picky/helpers/cache.rb in picky-1.0.0
- old
+ new
@@ -1,23 +1,25 @@
+# TODO Not used anymore? Remove.
#
-#
-module Helpers
+module Helpers # :nodoc:all
+
module Cache
# This is a simple cache.
# The store needs to be able to answer to [] and []=.
#
def cached store, key, &block
# Get cached result
#
results = store[key]
return results if results
-
+
results = lambda(&block).call
-
+
# Store results
#
store[key] = results
-
+
results
end
end
+
end
\ No newline at end of file