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 +4 -4
- data/lib/frenchy/collection.rb +13 -3
- data/lib/frenchy/model.rb +2 -2
- data/lib/frenchy/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4cde4334b428d72259e32e29a90918ffc10fa862
|
4
|
+
data.tar.gz: 05fc0f139745e732ce2c90dbe7eed9b742cff7df
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6ee4a3135c6b913671e8e989505907a949d02731341e010c4837931525a3379cafcf17b1177cd5200d588969586d727852172f7d09c1d29162a619c9c99e9402
|
7
|
+
data.tar.gz: 4a030622d592c83f4dabbe56a1fd2b83504af53655fdf7f53d666251db5f74882c9f575cdc6ce538a1e5e1f79736ba1342235240025a086a27708aecf0c3354a
|
data/lib/frenchy/collection.rb
CHANGED
@@ -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
|
-
|
6
|
-
|
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
|
data/lib/frenchy/version.rb
CHANGED
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.
|
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
|
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.
|
153
|
+
rubygems_version: 2.2.2
|
154
154
|
signing_key:
|
155
155
|
specification_version: 4
|
156
156
|
summary: Frenchy's got the goods
|