Sha256: 1984ce1097279b3183da5378891e700cf5db8b18f653a4ca5b7c7f473c862480
Contents?: true
Size: 858 Bytes
Versions: 3
Compression:
Stored size: 858 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
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
draper-1.0.0.beta3 | lib/draper/decoratable.rb |
draper-1.0.0.beta2 | lib/draper/decoratable.rb |
draper-1.0.0.beta1 | lib/draper/decoratable.rb |