module Wallaby::Decoratable::ClassMethods
Configurable attribute
Attributes
@!attribute [r] resource_decorator
Resource decorator will be used for its metadata info and decoration methods.
If Wallaby
doesn't get it right, please specify the resource_decorator. @example To set resource decorator
class Admin::ProductionsController < Admin::ApplicationController self.resource_decorator = ProductDecorator end
@return [Class] resource decorator @raise [ArgumentError] when resource_decorator doesn't inherit from application_decorator @see Wallaby::ResourceDecorator
@since wallaby-5.2.0
Public Instance Methods
@!attribute [r] application_decorator
The application_decorator is as the base class of {#resource_decorator}. @example To set application decorator:
class Admin::ApplicationController < Wallaby::ResourcesController self.application_decorator = AnotherApplicationDecorator end
@raise [ArgumentError] when resource_decorator doesn't inherit from application_decorator @return [Class] application decorator @see Wallaby::ResourceDecorator
@since wallaby-5.2.0
# File lib/concerns/wallaby/decoratable.rb, line 44 def application_decorator @application_decorator ||= ModuleUtils.try_to superclass, :application_decorator end
@!attribute [w] application_decorator
# File lib/concerns/wallaby/decoratable.rb, line 29 def application_decorator=(application_decorator) ModuleUtils.inheritance_check resource_decorator, application_decorator @application_decorator = application_decorator end
@!attribute [w] resource_decorator
# File lib/concerns/wallaby/decoratable.rb, line 9 def resource_decorator=(resource_decorator) ModuleUtils.inheritance_check resource_decorator, application_decorator @resource_decorator = resource_decorator end