frenchy 0.0.8 → 0.0.9

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: 4cde4334b428d72259e32e29a90918ffc10fa862
4
- data.tar.gz: 05fc0f139745e732ce2c90dbe7eed9b742cff7df
3
+ metadata.gz: cfc53ad6ae8399ce20c1088d4d8af731e38c3ebd
4
+ data.tar.gz: da03a49221e8e7c5aff1509fe8805788c1349670
5
5
  SHA512:
6
- metadata.gz: 6ee4a3135c6b913671e8e989505907a949d02731341e010c4837931525a3379cafcf17b1177cd5200d588969586d727852172f7d09c1d29162a619c9c99e9402
7
- data.tar.gz: 4a030622d592c83f4dabbe56a1fd2b83504af53655fdf7f53d666251db5f74882c9f575cdc6ce538a1e5e1f79736ba1342235240025a086a27708aecf0c3354a
6
+ metadata.gz: ed5d78ec4022471cf35a7eac83ca2c91f154c168e72eb039aeeb4e4ef82e8e9512318492e433cb61656e1f80792a0e27987ab9c5ba9a139f965936d53ec994d9
7
+ data.tar.gz: c0d155f5886853a2f4a8204d8a37c778903ecf395be03fc2e08989cb946b990091a2ebe66eff024d8ff0ceb80317126769fc6fe7edc641a7cbef871f4698d59a
@@ -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
- if decorator_class.respond_to?(:decorate_collection)
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
- "#{first.class.name}Decorator".constantize
17
- end
18
+ return Frenchy::ArrayDecorator if none?
18
19
 
19
- # Backwards compatibility for old version of draper
20
- def nil?
21
- none?
20
+ "#{first.class.name}Decorator".constantize
22
21
  end
23
22
  end
24
23
  end
@@ -1,3 +1,3 @@
1
1
  module Frenchy
2
- VERSION = "0.0.8"
2
+ VERSION = "0.0.9"
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.8
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-08 00:00:00.000000000 Z
11
+ date: 2014-09-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activemodel