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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: fc524377d735e5b78b0253e499c1f59b4c0f74e7127823408cf3fe94949202b7
4
- data.tar.gz: 0a9d6083dca72be52d659f2e3c408bd44dc8efcc944b4a92ca1627fdb5a72bcb
3
+ metadata.gz: e905dd27e48a5e199ad33a35a5b7200bc0e4b61083323a9a564b2c73446180b0
4
+ data.tar.gz: c107fbe5656b1575ec6f6b0fe6420907d16267d673cecf9e9f5d66604f26fd03
5
5
  SHA512:
6
- metadata.gz: eba4d418daa842a83eed3d4dd9dda7abedeb458a8d25d7930a8748a05e1318f0bb7f4ce4cf10d908d93761e2493843f772ac967b5d31334609c53197967d2306
7
- data.tar.gz: e4039af2d54cdb94abb210f59202f5230579bf98a1a726586721d12c5752d99052c72c0096128e9065c4b6cb31e37113c5b3a4bedab83efcc5c39cb61eff4206
6
+ metadata.gz: 85a770b79da9c0ae43780d069a1e1eb947061cd21297c4d641917f712bc6ee8010aef04324d2ef6a9a7fcae6df06683839e86c031c4afd5dae0bc08572e36c05
7
+ data.tar.gz: 8ae16911cc8fe2051c1fba8eab5f6b3b35d340cbfb75690cf05e4ccc050c23f39c612c7ca55329dccae991fc29a5ff657c3a49608013b4c7f42e93573307c256
@@ -1,3 +1,3 @@
1
1
  module Geckorate
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
  end
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.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-08-12 00:00:00.000000000 Z
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.3
94
+ rubygems_version: 2.7.6
95
95
  signing_key:
96
96
  specification_version: 4
97
97
  summary: A dead simple decorator for Ruby