kaminari-cache 0.1.1 → 0.1.2

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
  SHA1:
3
- metadata.gz: 559057935d4e2a19d75f01b08e66b22af7974c67
4
- data.tar.gz: a631703347f7caf672ce7916f800a0e2567b8510
3
+ metadata.gz: fcf6941acb7811fbb264ed38a2d8120a27de9c77
4
+ data.tar.gz: 06108cd6b5c14b5d32de8183e28b96e80d8d7eb2
5
5
  SHA512:
6
- metadata.gz: a6ee3881813ef0ba42eba4b110fc207cc80b1f652cb0e98e24bf59eaaabca18c2a32762009d3bad76a9362c0779b88b300d0d75ad0ab4ca66c5af2a13d412d6d
7
- data.tar.gz: b555bfc1c5d19e4c10757e91694b7cbeae6ab938795f30466a7a3eb186650fd64575e357b32b8178edc25a474e2d4e657752920319e51331cd4e17ca8051451d
6
+ metadata.gz: 16d7af7e8c95a105c307ed6ddafc9a1f9e90fd42939df03b15e294cc11d3976b9a875adf8ab8a61f7ff92db8a827d8269995d4698075a47b502b60ab0572e957
7
+ data.tar.gz: 769608844f1ceecb04f77a492d3b4f9b5d7bd0201f666d641da1eb9ae82e6eb635ab2b11fcebb7f89a2cee548316b72759a7c5f9da37078e63133b8ef17d2799
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- kaminari-cache (0.1.1)
4
+ kaminari-cache (0.1.2)
5
5
  kaminari-cache
6
6
 
7
7
  GEM
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Kaminari Cache
2
2
 
3
- Kaminari Cache makes caching your Kaminari pagination a breeze.
3
+ Kaminari Cache makes caching your Kaminari pagination a breeze
4
4
 
5
5
  ### Currently supported:
6
6
  * RedisStore for Redis
@@ -9,13 +9,21 @@ Kaminari Cache makes caching your Kaminari pagination a breeze.
9
9
 
10
10
  When using an unsupported cache engine, the entire cache will be flushed when editing a record.
11
11
 
12
+ ## Installation
13
+
14
+ Add this line to your application's Gemfile:
15
+
16
+ ```ruby
17
+ gem 'kaminari-cache'
18
+ ```
19
+
12
20
  ## Usage
13
21
 
14
22
  In your controller, simply call `Model.fetch_page` (instead of `Model.page`) with an options hash containing `:page`, `:per` & `:order`.
15
23
 
16
24
  `:order` can be a Symbol, a Hash or a String depending on your sorting needs.
17
25
 
18
- Example:
26
+ #### Example:
19
27
 
20
28
  In your controller:
21
29
  ```ruby
@@ -29,7 +37,7 @@ In your controller:
29
37
 
30
38
  In your view:
31
39
  ```ruby
32
- @events.entries.each do |entry|
40
+ @events.each do |entry|
33
41
  # Do your thing
34
42
  end
35
43
  ```
@@ -37,7 +45,7 @@ In your view:
37
45
  ## TODO
38
46
 
39
47
  * Testing!
40
- * More cache engines!
48
+ * More cache engines
41
49
 
42
50
  ## Contributing to Kaminari Cache
43
51
 
@@ -51,6 +59,6 @@ In your view:
51
59
 
52
60
  ## Copyright
53
61
 
54
- Copyright (c) 2013 Jim. See LICENSE.txt for
62
+ Copyright © 2013-2014 [Jim Durand](http://twitter.com/durandjim "Twitter"). See [LICENSE.txt](http://github.com/jdurand/kaminari-cache/blob/master/LICENSE.txt "LICENSE") for
55
63
  further details.
56
64
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.1
1
+ 0.1.2
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "kaminari-cache"
8
- s.version = "0.1.1"
8
+ s.version = "0.1.2"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Jim"]
12
- s.date = "2013-10-15"
12
+ s.date = "2013-11-05"
13
13
  s.description = "Kaminari Cache is a simple caching layer and sweeper for Kaminari pagination"
14
14
  s.email = "powerjim@gmail.com"
15
15
  s.extra_rdoc_files = [
@@ -40,13 +40,10 @@ module KaminariCache
40
40
  entries = Rails.cache.fetch(cache_key(options)) do
41
41
  scope = self.page(options[:page]).per(options[:per])
42
42
  scope = apply_sort(scope, options[:order])
43
-
44
- struct = OpenStruct.new(
45
- :entries => scope.entries,
46
- :all => scope.entries,
47
- :current_page => scope.current_page,
48
- :total_pages => scope.total_pages,
49
- :per_page => scope.limit_value
43
+ Kaminari::PaginatableArray.new(scope.to_a,
44
+ :limit => scope.limit_value,
45
+ :offset => scope.offset_value,
46
+ :total_count => scope.total_count
50
47
  )
51
48
  end
52
49
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kaminari-cache
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jim
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-10-15 00:00:00.000000000 Z
11
+ date: 2013-11-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: kaminari-cache