cache_cache 1.0.3 → 1.0.7

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.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +3 -1
  3. data/lib/cache_cache.rb +12 -6
  4. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7046f0dea6b49b4ef2b68d12855cdcbdac5c1934
4
- data.tar.gz: 9f9a961c1fc02e26ca730c557896c2f11bfb6db8
3
+ metadata.gz: 7735c7e0fe86a89b603b5332c015c8dcbefb4291
4
+ data.tar.gz: 3fad36577d012bb325e065ea8b6329fc2c8138cc
5
5
  SHA512:
6
- metadata.gz: d8ce0a2f855a00cead6307bfffa645ce4a0e826b4c992968c3187c0d279a91b95c1d15971a2c3245fb755cb270062fed62aed17b3528d88a7ca8b84d07ba5162
7
- data.tar.gz: fe58ddc3d1bced7a4d3792a91a27f669aa400f9bf03baee60403b4180f426b81487ec3e846d586e34932fcc7425153129e984b2930491d1388346b5dd58a7c79
6
+ metadata.gz: 3c0472976deeebb82b69f84244e3a3b439a1397b87ecff0e483f088170d8ece383ca81dda7fcde3d8b57ee4dfbf829a2719fdc98ad1b0ef30b038ef1d77080cd
7
+ data.tar.gz: 4272f766c9e050a9a59fe61ecd036c879ec6f89c6712d3cd7fcb61ae756c8a7e3adaa0c3d575481201b080c4585612a7fd04a4f37ebed8ae5c68a07566924e40
data/README.md CHANGED
@@ -13,6 +13,7 @@ CacheCache allow you to manage dynamically multiple groups of HTML5 manifests us
13
13
  cache ActionController::Base.helpers.asset_path("application.css")
14
14
  cache ActionController::Base.helpers.asset_path("application.js")
15
15
  network "*"
16
+ fallback "/error.html"
16
17
  save
17
18
  end
18
19
 
@@ -27,7 +28,8 @@ Display
27
28
  /assets/application.js
28
29
  NETWORK:
29
30
  *
30
- FALLBACK:
31
+ FALLBACK:
32
+ /error.html
31
33
 
32
34
  # Hint #
33
35
 
data/lib/cache_cache.rb CHANGED
@@ -10,6 +10,7 @@ module Rails
10
10
  def initialize(options = {}, &block)
11
11
  @memory_store = options.fetch(:memory_store, (ActiveSupport::Cache::MemoryStore.new rescue nil))
12
12
  @group = options.fetch(:group, :default)
13
+ @spoor = "generated by cache_cache"
13
14
 
14
15
  @cache = { }
15
16
  @network = { }
@@ -27,19 +28,21 @@ module Rails
27
28
  # Get / Set an entry into the cache section of the manifest
28
29
  #
29
30
  def cache(entry = nil)
31
+ @cache[@group] ||= []
32
+
30
33
  unless entry.nil?
31
- @cache[@group] ||= []
32
34
  @cache[@group] << entry
33
35
  end
34
36
 
35
- @cache[@group].flatten
37
+ @cache[@group].flatten
36
38
  end
37
39
 
38
40
  # Get / Set an entry into the network section of the manifest
39
41
  #
40
42
  def network(entry = nil)
43
+ @network[@group] ||= []
44
+
41
45
  unless entry.nil?
42
- @network[@group] ||= []
43
46
  @network[@group] << entry
44
47
  end
45
48
 
@@ -49,8 +52,9 @@ module Rails
49
52
  # Get / Set an entry into the fallback section of the manifest
50
53
  #
51
54
  def fallback(entry = nil)
55
+ @fallback[@group] ||= []
56
+
52
57
  unless entry.nil?
53
- @fallback[@group] ||= []
54
58
  @fallback[@group] << entry
55
59
  end
56
60
 
@@ -99,8 +103,10 @@ module Rails
99
103
 
100
104
  # Get the spoor of the manifest
101
105
  #
102
- def spoor
103
- "# generated by cache_cache"
106
+ def spoor(spoor_content = nil)
107
+ @spoor = spoor_content unless spoor_content.nil?
108
+
109
+ "# " + @spoor
104
110
  end
105
111
 
106
112
  # Get label
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cache_cache
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.3
4
+ version: 1.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Clement Bruchon
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-12-17 00:00:00.000000000 Z
11
+ date: 2014-01-03 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: CacheCache allow you to manage dynamically multiple groups of HTML5 manifests
14
14
  using rails cache.