api-pagination 4.8.0 → 4.8.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/api-pagination.rb +3 -2
- data/lib/api-pagination/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3bb99a6e4283fff7d5fa69b46f58e2b464817aa85a9377c0dee0712ec53e2966
|
4
|
+
data.tar.gz: ea909de1558e7d1db8492b61cb6140acaf4b97431d77716995fd9878f4c47b1b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3d648ef5559a8200612186dac182f1fee3b8babb294c54762e241f41b9e7f4ffc673ba21aa51ece2dff4bfa39a17bf6b9f78d3a44bd52d2f581aba63e7a4051f
|
7
|
+
data.tar.gz: 0c90a0cb15d533248f848fb590694a190b62eb13df4ddea426889740d848e9ed0d9eac64d7a5dc40b5aec222d995f91fac8070d60eea0ae3750cb6d0f48220ef
|
data/lib/api-pagination.rb
CHANGED
@@ -21,7 +21,7 @@ module ApiPagination
|
|
21
21
|
end
|
22
22
|
|
23
23
|
def pages_from(collection, options = {})
|
24
|
-
return pagy_pages_from(collection) if collection.is_a?(Pagy)
|
24
|
+
return pagy_pages_from(collection) if ApiPagination.config.paginator == :pagy && collection.is_a?(Pagy)
|
25
25
|
|
26
26
|
{}.tap do |pages|
|
27
27
|
unless collection.first_page?
|
@@ -64,7 +64,8 @@ module ApiPagination
|
|
64
64
|
end
|
65
65
|
|
66
66
|
def pagy_from(collection, options)
|
67
|
-
|
67
|
+
count = collection.is_a?(Array) ? collection.count : collection.count(:all)
|
68
|
+
Pagy.new(count: count, items: options[:per_page], page: options[:page])
|
68
69
|
end
|
69
70
|
|
70
71
|
def pagy_pages_from(pagy)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: api-pagination
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.8.
|
4
|
+
version: 4.8.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Celis
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-06-
|
11
|
+
date: 2018-06-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|