Class: Frenchy::Collection
- Inherits:
-
Array
- Object
- Array
- Frenchy::Collection
- Defined in:
- lib/frenchy/collection.rb
Instance Method Summary collapse
-
#decorate(options = {}) ⇒ Object
Decorate the collection using the name of the decorator inferred by the first record.
-
#decorator_class ⇒ Object
Compatbility for associations in draper.
Instance Method Details
#decorate(options = {}) ⇒ Object
Decorate the collection using the name of the decorator inferred by the first record
10 11 12 13 14 |
# File 'lib/frenchy/collection.rb', line 10 def decorate(={}) return self if none? decorator_class.decorate_collection(self, ) end |
#decorator_class ⇒ Object
Compatbility for associations in draper
17 18 19 20 21 |
# File 'lib/frenchy/collection.rb', line 17 def decorator_class return Frenchy::ArrayDecorator if none? "#{first.class.name}Decorator".constantize end |