cache_with_settings 1.0.0 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c0afd8964a34b654ac33eb73501f28bff8e170667452b409749e48902bca8e7a
4
- data.tar.gz: 3adbf5daaad4d0c8213205aab8b6ec24c38c1f123df18b64707b8429816709b4
3
+ metadata.gz: 57ebed20eb0d765842ce7458b3c3132fa56e36ef83d8398420a214df29241ce6
4
+ data.tar.gz: 35d0952e1a8fe83be020898ea874cd398675a8d497a6ffa03df1f13f5cb6ee03
5
5
  SHA512:
6
- metadata.gz: 12e521466bbbe4494339c7e79ebebee5b3ba40d3e568f60bc56eb0116e69adc5ad703f81d9974e7873c23fec05c38f8bdf71404405ffdc58e932a9ec3cb7a542
7
- data.tar.gz: bbfcbac8a8dde1644024bf5353ed6d618574a23baad684a8c7cc1dfd23592ba110d94e1288effecc7f0141db6dbd610f35642c6e73c71eeec18e4fd4ba9d932e
6
+ metadata.gz: a203fd0b9e512b17cfddf6a78b9eb3ccccfd6c597cbd875d1b5e9af20fe00047a13f0daa893e5abe9425a6e80d93580fcaf7c891e92cddac8971f47bc8791258
7
+ data.tar.gz: f923131cc36b7b7c69ee337fadd72b26b731e787d8d55ead36fa06e43ceecbe11ebaf47e47890fa67c8751e242460ce022de73681958c128e03c8b1d16a13e1c
data/README.md CHANGED
@@ -1,7 +1,8 @@
1
- [![Build Status](https://travis-ci.org/richardvenneman/cache_with_settings.svg?branch=master)](https://travis-ci.org/richardvenneman/cache_with_settings)
1
+ # CacheWithSettings
2
+ CacheWithSettings allows you to add any key to partial caching cache keys. This is useful if your website is multilingual or allows the user to choose a display currency.
2
3
 
3
- # Rails cache_with_settings
4
- CacheWithSettings allows you to add any keys to partial caching cache keys. This is useful if your website is multilingual or allows the user to choose a display currency.
4
+ [![Build Status](https://travis-ci.org/richardvenneman/cache_with_settings.svg?branch=master)](https://travis-ci.org/richardvenneman/cache_with_settings)
5
+ [![Gem Version](https://badge.fury.io/rb/cache_with_settings.svg)](https://badge.fury.io/rb/cache_with_settings)
5
6
 
6
7
  ## Problem & Solution
7
8
  If you find yourself adding dynamic values, such as locales and currencies to your cache keys, this gem could be useful for you. Instead of:
@@ -25,7 +26,8 @@ After adding the gem to your Gemfile, configure CacheWithSettings in an initiali
25
26
 
26
27
  ```ruby
27
28
  CacheWithSettings.configure do |config|
28
- config.cache_keys = [I18n.locale.to_s, MoneyRails.default_currency.to_s]
29
+ # Specify a proc that returns an array of strings
30
+ config.cache_keys = -> { [I18n.locale.to_s, MoneyRails.default_currency.to_s] }
29
31
  end
30
32
  ```
31
33
 
@@ -13,7 +13,7 @@ module CacheWithSettings
13
13
 
14
14
  private
15
15
  def cache_with_settings_compose_key(key)
16
- Array.wrap(key).concat(CacheWithSettings.cache_keys)
16
+ Array.wrap(key).concat(CacheWithSettings.cache_keys.call)
17
17
  end
18
18
  end
19
19
  end
@@ -2,7 +2,7 @@
2
2
 
3
3
  module CacheWithSettings
4
4
  mattr_accessor :cache_keys
5
- self.cache_keys = []
5
+ self.cache_keys = -> { [] }
6
6
 
7
7
  def self.configure
8
8
  yield self
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module CacheWithSettings
4
- VERSION = "1.0.0"
4
+ VERSION = "1.0.1"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cache_with_settings
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Richard Venneman