geckorate 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/geckorate/version.rb +1 -1
- data/lib/geckorate.rb +6 -6
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e905dd27e48a5e199ad33a35a5b7200bc0e4b61083323a9a564b2c73446180b0
|
4
|
+
data.tar.gz: c107fbe5656b1575ec6f6b0fe6420907d16267d673cecf9e9f5d66604f26fd03
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 85a770b79da9c0ae43780d069a1e1eb947061cd21297c4d641917f712bc6ee8010aef04324d2ef6a9a7fcae6df06683839e86c031c4afd5dae0bc08572e36c05
|
7
|
+
data.tar.gz: 8ae16911cc8fe2051c1fba8eab5f6b3b35d340cbfb75690cf05e4ccc050c23f39c612c7ca55329dccae991fc29a5ff657c3a49608013b4c7f42e93573307c256
|
data/lib/geckorate/version.rb
CHANGED
data/lib/geckorate.rb
CHANGED
@@ -5,10 +5,10 @@ module Geckorate
|
|
5
5
|
def decorate; end
|
6
6
|
|
7
7
|
class << self
|
8
|
-
def decorate_collection(collection)
|
8
|
+
def decorate_collection(collection, class_name = nil)
|
9
9
|
return [] if collection.empty?
|
10
10
|
|
11
|
-
klass = collection.first.class
|
11
|
+
klass = class_name || collection.first.class
|
12
12
|
full_klass_name = klass.to_s.concat('Decorator')
|
13
13
|
decorator_klass = Class.const_get(full_klass_name)
|
14
14
|
|
@@ -17,21 +17,21 @@ module Geckorate
|
|
17
17
|
end
|
18
18
|
end
|
19
19
|
|
20
|
-
def decorate_kaminari_collection(collection)
|
20
|
+
def decorate_kaminari_collection(collection, class_name = nil)
|
21
21
|
{
|
22
22
|
page: collection.current_page,
|
23
23
|
per_page: collection.current_per_page,
|
24
24
|
total: collection.total_count,
|
25
|
-
records: decorate_collection(collection)
|
25
|
+
records: decorate_collection(collection, class_name)
|
26
26
|
}
|
27
27
|
end
|
28
28
|
|
29
|
-
def decorate_will_paginate_collection(collection)
|
29
|
+
def decorate_will_paginate_collection(collection, class_name = nil)
|
30
30
|
{
|
31
31
|
page: collection.current_page,
|
32
32
|
per_page: collection.per_page,
|
33
33
|
total: collection.total_entries,
|
34
|
-
records: decorate_collection(collection)
|
34
|
+
records: decorate_collection(collection, class_name)
|
35
35
|
}
|
36
36
|
end
|
37
37
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: geckorate
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ahmed Saleh
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-10-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -91,7 +91,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
91
91
|
version: '0'
|
92
92
|
requirements: []
|
93
93
|
rubyforge_project:
|
94
|
-
rubygems_version: 2.7.
|
94
|
+
rubygems_version: 2.7.6
|
95
95
|
signing_key:
|
96
96
|
specification_version: 4
|
97
97
|
summary: A dead simple decorator for Ruby
|