module Draper::Decoratable
Provides shortcuts to decorate objects directly, so you can do ‘@product.decorate` instead of `ProductDecorator.new(@product)`.
This module is included by default into ‘ActiveRecord::Base` and `Mongoid::Document`, but you’re using another ORM, or want to decorate plain old Ruby objects, you can include it manually.
Public Instance Methods
Source
# File lib/draper/decoratable.rb, line 35 def applied_decorators [] end
The list of decorators that have been applied to the object.
@return [Array<Class>] ‘[]`
Source
# File lib/draper/decoratable.rb, line 19 def decorate(options = {}) decorator_class.decorate(self, options) end
Decorates the object using the inferred {#decorator_class}. @param [Hash] options
see {Decorator#initialize}
Source
# File lib/draper/decoratable.rb, line 48 def decorated? false end
Checks if this object is decorated.
@return [false]
Source
# File lib/draper/decoratable.rb, line 41 def decorated_with?(decorator_class) false end
(see Decorator#decorated_with?
) @return [false]
Source
# File lib/draper/decoratable.rb, line 24 def decorator_class self.class.decorator_class end
Source
# File lib/draper/decoratable.rb, line 28 def decorator_class? self.class.decorator_class? end