module Draper::Decoratable::ClassMethods
def ===(other)
-
(Boolean)
-
def ===(other) super || (other.is_a?(Draper::Decorator) && super(other.object)) end
def decorate(options = {})
-
options
(Hash
) --
def decorate(options = {}) decorator_class.decorate_collection(all, options.reverse_merge(with: nil)) end
def decorator_class(called_on = self)
-
(Class)
- the inferred decorator class.
def decorator_class(called_on = self) prefix = respond_to?(:model_name) ? model_name : name decorator_name = "#{prefix}Decorator" decorator_name_constant = decorator_name.safe_constantize return decorator_name_constant unless decorator_name_constant.nil? if superclass.respond_to?(:decorator_class) superclass.decorator_class(called_on) else raise Draper::UninferrableDecoratorError.new(called_on) end end
def decorator_class?
def decorator_class? decorator_class rescue Draper::UninferrableDecoratorError false end