gleborator 0.1.1.7 → 0.1.1.8

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
  SHA1:
3
- metadata.gz: aaf1c14e110ce0d34c37c917408f1dd1c3ede779
4
- data.tar.gz: 63dc06f43a03adc4a05e31f1ddd404717d430798
3
+ metadata.gz: 94ffe24be5917fadd0306a1f30a9e13b7863bff2
4
+ data.tar.gz: 6df36b9c9305db217456e938054a1bc1e82539d4
5
5
  SHA512:
6
- metadata.gz: 49b122fac3fc31b413f7451e8be10d2bb01d133d9880d1b49aa18a9804487c57b89eb3fa08452e7e726ff25c9a5e39776f798edc79a5cd06c0d47398c2a30113
7
- data.tar.gz: c887ab9192b005e884bb563a7b1f4ccfa1578385b8c956fd23fbac25ef6754254b48969550c58d59aad3bca5d835149d9eae44f43e9423f4055787bf209f6f16
6
+ metadata.gz: 0328f12583786884d1d6edc54f5544d2c700ab4c30018d6d1f663b81e268b16a390b493504ad1262dec61ce2a76592c1873928b183a830edba4f34dd81762dbe
7
+ data.tar.gz: 534ce1a9125fcd250ae3f11b003f013b690de42bc7ab7345a9c332dd32969dcbc98df19fff051561d9399d76137fc2b31ca3260bb6344f06c51d84e4fddb146f
@@ -3,23 +3,26 @@ module Gleborator
3
3
  extend ActiveSupport::Concern
4
4
 
5
5
  def decorate
6
- begin
7
- decorator_class = "#{self.class.name}Decorator".constantize
8
- decorator_class.new(self)
9
- rescue NameError => e
10
- raise "Couldn't find decorator #{self.class.name}Decorator"
11
- end
6
+ decorator_class.new(self)
7
+ end
8
+
9
+ def decorator_class
10
+ self.class.decorator_class
12
11
  end
13
12
 
14
13
  module ClassMethods
15
14
  def decorate
16
- # begin
17
- raise self.inspect
18
- decorator_class = "#{self.name}Decorator".constantize
19
- decorator_class.decorate_collection(self)
20
- # rescue NameError => e
21
- # raise "Couldn't find decorator #{self.name}Decorator"
22
- # end
15
+ decorator_class.decorate_collection all
16
+ end
17
+
18
+ def decorator_class
19
+ begin
20
+ prefix = respond_to?(:model_name) ? model_name : name
21
+ decorator_name = "#{prefix}Decorator"
22
+ decorator_name.constantize
23
+ rescue NameError => e
24
+ raise "Couldn't find decorator #{decorator_name}"
25
+ end
23
26
  end
24
27
  end
25
28
  end
@@ -1,3 +1,3 @@
1
1
  module Gleborator
2
- VERSION = "0.1.1.7"
2
+ VERSION = "0.1.1.8"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gleborator
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1.7
4
+ version: 0.1.1.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gleb Vishnevsky