Sha256: d537e87f6dcb25890bd72a29693a65baa0a744be4a730b36c1307c07bc3ecc91
Contents?: true
Size: 857 Bytes
Versions: 2
Compression:
Stored size: 857 Bytes
Contents
module Draper::Decoratable extend ActiveSupport::Concern def decorate(options = {}) decorator_class.decorate(self, options) end def decorator_class self.class.decorator_class end def applied_decorators [] end def decorated_with?(decorator_class) false end def decorated? false end def ==(other) super || (other.respond_to?(:source) && super(other.source)) end module ClassMethods def decorate(options = {}) decorator_class.decorate_collection(self.scoped, options) end def decorator_class prefix = respond_to?(:model_name) ? model_name : name "#{prefix}Decorator".constantize rescue NameError raise Draper::UninferrableDecoratorError.new(self) end def ===(other) super || (other.respond_to?(:source) && super(other.source)) end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
draper-1.0.0.beta5 | lib/draper/decoratable.rb |
draper-1.0.0.beta4 | lib/draper/decoratable.rb |