Skip to content

Commit

Permalink
Document Tilt::Cache#fetch.
Browse files Browse the repository at this point in the history
  • Loading branch information
tommay committed Jul 11, 2015
1 parent 75ebbfc commit 3c2af16
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lib/tilt.rb
Expand Up @@ -93,7 +93,12 @@ def initialize
@cache = {}
end

# @see Cache
# Caches a value for key, or returns the previously cached value.
# If a value has been previously cached for key then it is
# returned. Otherwise, key is yielded and the value returned by the block,
# which may be nil, is cached under key and returned.
# @yieldparam key the key passed to #fetch.
# @yieldreturn the value to cache for key
def fetch(*key)
@cache.fetch(key) do
@cache[key] = yield
Expand Down

0 comments on commit 3c2af16

Please sign in to comment.