frenchy 0.0.7 → 0.0.8

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
  SHA1:
3
- metadata.gz: 37216ca75dbf240d76ca4f7db7eb02984459d5a3
4
- data.tar.gz: b8f71d9be3b8853664ba84dd000427c13ef05c14
3
+ metadata.gz: 4cde4334b428d72259e32e29a90918ffc10fa862
4
+ data.tar.gz: 05fc0f139745e732ce2c90dbe7eed9b742cff7df
5
5
  SHA512:
6
- metadata.gz: 5a0b31d927cbe19c18554dc98f076bd5ac32cef99fc69b145f90141b7e969a88ea3d16fd8ca576f5675b193b941a5788fbdd428bee856ba768bd93fb5e37c704
7
- data.tar.gz: a802d114e6ee44ed790a7322fbde501348815ccfbbaee6c1f7d26f85f1ba1d801878fff619ab7056d565010ff901dfebe5d8b217c3883d20e18051443b5e395b
6
+ metadata.gz: 6ee4a3135c6b913671e8e989505907a949d02731341e010c4837931525a3379cafcf17b1177cd5200d588969586d727852172f7d09c1d29162a619c9c99e9402
7
+ data.tar.gz: 4a030622d592c83f4dabbe56a1fd2b83504af53655fdf7f53d666251db5f74882c9f575cdc6ce538a1e5e1f79736ba1342235240025a086a27708aecf0c3354a
@@ -1,9 +1,19 @@
1
1
  module Frenchy
2
2
  class Collection < ::Array
3
3
  # Decorate the collection using the name of the decorator inferred by the first record
4
- def decorate
5
- decorator_class = "#{first.class.name}Decorator".constantize
6
- decorator_class.decorate(self)
4
+ def decorate(options={})
5
+ return self if none?
6
+
7
+ if decorator_class.respond_to?(:decorate_collection)
8
+ decorator_class.decorate_collection(self)
9
+ else
10
+ decorator_class.decorate(self)
11
+ end
12
+ end
13
+
14
+ # Compatbility for associations in draper
15
+ def decorator_class
16
+ "#{first.class.name}Decorator".constantize
7
17
  end
8
18
 
9
19
  # Backwards compatibility for old version of draper
data/lib/frenchy/model.rb CHANGED
@@ -31,9 +31,9 @@ module Frenchy
31
31
  end
32
32
 
33
33
  # Decorate the model using a decorator inferred by the class
34
- def decorate
34
+ def decorate(options={})
35
35
  decorator_class = "#{self.class.name}Decorator".constantize
36
- decorator_class.decorate(self)
36
+ decorator_class.decorate(self, options)
37
37
  end
38
38
 
39
39
  protected
@@ -1,3 +1,3 @@
1
1
  module Frenchy
2
- VERSION = "0.0.7"
2
+ VERSION = "0.0.8"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: frenchy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jason Coene
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-08-01 00:00:00.000000000 Z
11
+ date: 2014-09-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activemodel
@@ -150,7 +150,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
150
150
  version: '0'
151
151
  requirements: []
152
152
  rubyforge_project:
153
- rubygems_version: 2.2.0
153
+ rubygems_version: 2.2.2
154
154
  signing_key:
155
155
  specification_version: 4
156
156
  summary: Frenchy's got the goods