Class: Railsboot::Toast::BodyComponent
- Inherits:
-
Component
- Object
- Component
- Railsboot::Toast::BodyComponent
- Defined in:
- app/components/railsboot/toast/body_component.rb
Overview
ViewComponent: renders the body block of a Bootstrap toast.
Instance Method Summary collapse
-
#call ⇒ String
Renders the toast body element wrapping the component's content.
-
#initialize(**html_attributes) ⇒ BodyComponent
constructor
A new instance of BodyComponent.
Constructor Details
#initialize(**html_attributes) ⇒ BodyComponent
Returns a new instance of BodyComponent.
8 9 10 11 12 13 14 15 16 |
# File 'app/components/railsboot/toast/body_component.rb', line 8 def initialize(**html_attributes) @html_attributes = html_attributes @html_attributes[:tag] = "div" @html_attributes[:class] = class_names( "toast-body", html_attributes.delete(:class) ) end |
Instance Method Details
#call ⇒ String
Renders the toast body element wrapping the component's content.
20 21 22 |
# File 'app/components/railsboot/toast/body_component.rb', line 20 def call render(Railsboot::BaseComponent.new(**@html_attributes)) { content } end |