sprockets

https://github.com/rails/sprockets

Ruby

Rack-based asset packaging system

Sprockets::Cache#fetch

Public: Prefer API to retrieve and set values in the cache store.

key   - JSON serializable key
block -
  Must return a consistent JSON serializable object for the given key.

Examples

  cache.fetch("foo") { "bar" }

Returns a JSON serializable object.

Source | Google | Stack overflow

Edit

git clone [email protected]:rails/sprockets.git

cd sprockets

open lib/sprockets/cache.rb

Contribute

# Make a new branch

git checkout -b -your-name--update-docs-Sprockets--Cache-fetch-for-pr


# Commit to git

git add lib/sprockets/cache.rbgit commit -m "better docs for Sprockets::Cache#fetch"


# Open pull request

gem install hub # on a mac you can `brew install hub`

hub fork

git push <your name> -your-name--update-docs-Sprockets--Cache-fetch-for-pr

hub pull-request


# Celebrate!