geckorate 0.1.2 → 0.2.0

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
  SHA256:
3
- metadata.gz: e905dd27e48a5e199ad33a35a5b7200bc0e4b61083323a9a564b2c73446180b0
4
- data.tar.gz: c107fbe5656b1575ec6f6b0fe6420907d16267d673cecf9e9f5d66604f26fd03
3
+ metadata.gz: 35f3de94b8e35723fafca3d753d3cb73de5780ae856c65ac01b78745969fc4fa
4
+ data.tar.gz: fff006750bb1239bc7ee0aea196a96c97a3272e734cfc175c0384982df05ab13
5
5
  SHA512:
6
- metadata.gz: 85a770b79da9c0ae43780d069a1e1eb947061cd21297c4d641917f712bc6ee8010aef04324d2ef6a9a7fcae6df06683839e86c031c4afd5dae0bc08572e36c05
7
- data.tar.gz: 8ae16911cc8fe2051c1fba8eab5f6b3b35d340cbfb75690cf05e4ccc050c23f39c612c7ca55329dccae991fc29a5ff657c3a49608013b4c7f42e93573307c256
6
+ metadata.gz: c5e2e5e8cdc9e99cb13046e9df6b584b2aac89a554949b2f307afff9d90882bc5dd8638d8df653eff74f39043733cc11f26d3affc6c8501bbaebbee62b6c20ff
7
+ data.tar.gz: 724aa2b1b508faf47f088e81018031de246276de52c5f0989de3426b3547d4de623a03307464e8f7990f0ffcc8ba92a9e2661ee0dddbc3bfd26a32a28b976dc0
@@ -1,3 +1,3 @@
1
1
  module Geckorate
2
- VERSION = "0.1.2"
2
+ VERSION = "0.2.0"
3
3
  end
data/lib/geckorate.rb CHANGED
@@ -2,10 +2,10 @@ require "geckorate/version"
2
2
 
3
3
  module Geckorate
4
4
  class Decorator < SimpleDelegator
5
- def decorate; end
5
+ def decorate(options = {}); end
6
6
 
7
7
  class << self
8
- def decorate_collection(collection, class_name = nil)
8
+ def decorate_collection(collection, class_name: nil, options: {})
9
9
  return [] if collection.empty?
10
10
 
11
11
  klass = class_name || collection.first.class
@@ -13,25 +13,25 @@ module Geckorate
13
13
  decorator_klass = Class.const_get(full_klass_name)
14
14
 
15
15
  collection.map do |item|
16
- decorator_klass.new(item).decorate
16
+ decorator_klass.new(item).decorate(options: options)
17
17
  end
18
18
  end
19
19
 
20
- def decorate_kaminari_collection(collection, class_name = nil)
20
+ def decorate_kaminari_collection(collection, class_name: nil, options: {})
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, class_name)
25
+ records: decorate_collection(collection, class_name: class_name, options: options)
26
26
  }
27
27
  end
28
28
 
29
- def decorate_will_paginate_collection(collection, class_name = nil)
29
+ def decorate_will_paginate_collection(collection, class_name: nil, options: {})
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, class_name)
34
+ records: decorate_collection(collection, class_name: class_name, options: options)
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.2
4
+ version: 0.2.0
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-10-25 00:00:00.000000000 Z
11
+ date: 2019-04-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -90,8 +90,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
90
90
  - !ruby/object:Gem::Version
91
91
  version: '0'
92
92
  requirements: []
93
- rubyforge_project:
94
- rubygems_version: 2.7.6
93
+ rubygems_version: 3.0.3
95
94
  signing_key:
96
95
  specification_version: 4
97
96
  summary: A dead simple decorator for Ruby