Class: ActiveElement::Components::Util::Decorator
- Inherits:
-
Object
- Object
- ActiveElement::Components::Util::Decorator
- Defined in:
- lib/active_element/components/util/decorator.rb
Overview
Decorates a field by rendering a user-provided partial found in app/views/decorators/<model-name-plural>/_<field-name>.html.erb
Instance Method Summary collapse
- #decorated_value ⇒ Object
-
#initialize(component:, item:, field:, value:) ⇒ Decorator
constructor
A new instance of Decorator.
Constructor Details
#initialize(component:, item:, field:, value:) ⇒ Decorator
Returns a new instance of Decorator.
9 10 11 12 13 14 |
# File 'lib/active_element/components/util/decorator.rb', line 9 def initialize(component:, item:, field:, value:) @component = component @item = item @field = field @value = value end |
Instance Method Details
#decorated_value ⇒ Object
16 17 18 19 20 |
# File 'lib/active_element/components/util/decorator.rb', line 16 def decorated_value return default_decorated_value unless decorate? render end |