lib/mrcr/cache.rb in mrcr-cache-0.1.1 vs lib/mrcr/cache.rb in mrcr-cache-0.1.2
- old
+ new
@@ -36,11 +36,11 @@
@__cache__
end
# Caches a result of the block evaluation
#
- # @param [Array<Object>] args List of hashable objects
+ # @param [Object] key Hashable object
# @yield An arbitrary block
#
# @note beware Proc instance hashes are not equal, i.e. -> { 1 }.hash != -> { 1 }.hash,
# this means you shouldn't pass Procs in args unless you're sure
# they are always the same instances, otherwise you introduce a memory leak
@@ -50,11 +50,12 @@
cache.fetch_or_store(key.hash, &block)
end
# Caches a result of the block evaluation
#
- # @param [Array<Object>] args List of hashable objects
+ # @param [Object] args Hashable object
+ # @param [Object] default Default value
# @yield An arbitrary block
#
# @note beware Proc instance hashes are not equal, i.e. -> { 1 }.hash != -> { 1 }.hash,
# this means you shouldn't pass Procs in args unless you're sure
# they are always the same instances, otherwise you introduce a memory leak
@@ -66,21 +67,21 @@
# Instance methods
module Methods
# Delegates call to the class-level method
#
- # @param [Array<Object>] args List of hashable objects
+ # @param [Array<Object>] key Hashable object
# @yield An arbitrary block
#
# @return [Object] block's return value
def fetch_or_store(key, &block)
self.class.fetch_or_store(key, &block)
end
# Delegates call to the class-level method
#
- # @param [Object] value List of hashable objects
- # @param [Object] default List of hashable objects
+ # @param [Object] key Hashable object
+ # @param [Object] default Default value.
# @yield An arbitrary block
#
# @return [Object] block's return value
def fetch(key, default = nil)
self.class.fetch(key, default)