module Hanami::View::DecoratedAttributes::ClassInterface
Decorated attributes class-level interface.
@api public @since 2.1.0
Constants
- MODULE_NAME
-
@api private
Public Instance Methods
Source
# File lib/hanami/view/decorated_attributes.rb, line 42 def decorate(*names, **options) decorated_attributes.decorate(*names, **options) end
Decorates the provided attributes, wrapping them in Parts using the current render environment.
@example
class Article < Hanami::View::Part decorate :feature_image decorate :author as: :person end
@param names [Array<Symbol>] the attribute names @param options [Hash] the options to pass to the Part
Builder @option options [Symbol, Class] :as an alternative name or class to use when finding a
matching Part
@api public @since 2.1.0
Private Instance Methods
Source
# File lib/hanami/view/decorated_attributes.rb, line 48 def decorated_attributes if const_defined?(MODULE_NAME, false) const_get(MODULE_NAME) else const_set(MODULE_NAME, Attributes.new).tap do |mod| prepend mod end end end