grape_serializer 0.0.8 → 0.0.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/list_entity.rb +15 -3
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6e4c68d3adfb3518cffdcd294ca2b0d7b1ef828afd09fc8af8fae89296f36e92
|
4
|
+
data.tar.gz: 8c09ad8e4ec38069d4deb3bc69d057ffbb0a930871094949efa7e6b85017a9f1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5db0cf312dc08b04e40a5a6888f0e10e20d3bb85c3f97eb7403dda9117dbfbec5e13a92b4778a0ac7b72892c27038fcd70128626f9997062b0bcd8d9e51fde81
|
7
|
+
data.tar.gz: c1ed3468512a73894c2f328f6e78d76c8cdf6efe3877ce63fb2b82bfa0b79d6aae41baec10c11cd677a17a9da9401a453b169a9b58816f0ab76b3dcac8f3972a
|
data/lib/list_entity.rb
CHANGED
@@ -15,15 +15,27 @@ class ListEntity < ServiceEntity
|
|
15
15
|
end
|
16
16
|
|
17
17
|
def total_count
|
18
|
-
pagination_items.total_count
|
18
|
+
if pagination_items.respond_to?(:total_count)
|
19
|
+
pagination_items.total_count
|
20
|
+
elsif pagination_items.respond_to?(:length)
|
21
|
+
pagination_items.length
|
22
|
+
end
|
19
23
|
end
|
20
24
|
|
21
25
|
def current_page
|
22
|
-
pagination_items.current_page
|
26
|
+
if pagination_items.respond_to?(:current_page)
|
27
|
+
pagination_items.current_page
|
28
|
+
else
|
29
|
+
1
|
30
|
+
end
|
23
31
|
end
|
24
32
|
|
25
33
|
def total_pages
|
26
|
-
pagination_items.total_pages
|
34
|
+
if pagination_items.respond_to?(:total_pages)
|
35
|
+
pagination_items.total_pages
|
36
|
+
else
|
37
|
+
0
|
38
|
+
end
|
27
39
|
end
|
28
40
|
|
29
41
|
end
|