Sha256: 3ebbdd96430049f3ecb8a934810c1ae473b5acc18bdbcb4fd606b90fea8ec59c
Contents?: true
Size: 551 Bytes
Versions: 19
Compression:
Stored size: 551 Bytes
Contents
module Frenchy class ArrayDecorator def self.decorate_collection(object, options={}) object.to_a end end class Collection < ::Array # Decorate the collection using the name of the decorator inferred by the first record def decorate(options={}) return self if none? decorator_class.decorate_collection(self, options) end # Compatbility for associations in draper def decorator_class return Frenchy::ArrayDecorator if none? "#{first.class.name}Decorator".constantize end end end
Version data entries
19 entries across 19 versions & 1 rubygems