frenchy 0.0.8 → 0.0.9
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 +4 -4
- data/lib/frenchy/collection.rb +9 -10
- data/lib/frenchy/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cfc53ad6ae8399ce20c1088d4d8af731e38c3ebd
|
4
|
+
data.tar.gz: da03a49221e8e7c5aff1509fe8805788c1349670
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ed5d78ec4022471cf35a7eac83ca2c91f154c168e72eb039aeeb4e4ef82e8e9512318492e433cb61656e1f80792a0e27987ab9c5ba9a139f965936d53ec994d9
|
7
|
+
data.tar.gz: c0d155f5886853a2f4a8204d8a37c778903ecf395be03fc2e08989cb946b990091a2ebe66eff024d8ff0ceb80317126769fc6fe7edc641a7cbef871f4698d59a
|
data/lib/frenchy/collection.rb
CHANGED
@@ -1,24 +1,23 @@
|
|
1
1
|
module Frenchy
|
2
|
+
class ArrayDecorator
|
3
|
+
def self.decorate_collection(object, options={})
|
4
|
+
object.to_a
|
5
|
+
end
|
6
|
+
end
|
7
|
+
|
2
8
|
class Collection < ::Array
|
3
9
|
# Decorate the collection using the name of the decorator inferred by the first record
|
4
10
|
def decorate(options={})
|
5
11
|
return self if none?
|
6
12
|
|
7
|
-
|
8
|
-
decorator_class.decorate_collection(self)
|
9
|
-
else
|
10
|
-
decorator_class.decorate(self)
|
11
|
-
end
|
13
|
+
decorator_class.decorate_collection(self)
|
12
14
|
end
|
13
15
|
|
14
16
|
# Compatbility for associations in draper
|
15
17
|
def decorator_class
|
16
|
-
|
17
|
-
end
|
18
|
+
return Frenchy::ArrayDecorator if none?
|
18
19
|
|
19
|
-
|
20
|
-
def nil?
|
21
|
-
none?
|
20
|
+
"#{first.class.name}Decorator".constantize
|
22
21
|
end
|
23
22
|
end
|
24
23
|
end
|
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.9
|
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-09-
|
11
|
+
date: 2014-09-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activemodel
|