Class: Railsboot::FlashComponent
- Inherits:
-
Component
- Object
- Component
- Railsboot::FlashComponent
- Defined in:
- app/components/railsboot/flash_component.rb
Overview
ViewComponent: renders the flash block.
Constant Summary collapse
- FLASH_TYPES =
Recognised flash types.
%i[notice alert info].freeze
- FLASH_MAPPING =
Flash mapping.
{ notice: "success", alert: "danger", info: "info" }.freeze
Instance Method Summary collapse
-
#initialize(flash:, **html_attributes) ⇒ FlashComponent
constructor
A new instance of FlashComponent.
-
#render? ⇒ Boolean
Whether the flash block should be rendered.
Constructor Details
#initialize(flash:, **html_attributes) ⇒ FlashComponent
Returns a new instance of FlashComponent.
16 17 18 19 |
# File 'app/components/railsboot/flash_component.rb', line 16 def initialize(flash:, **html_attributes) @flash = flash @html_attributes = html_attributes end |
Instance Method Details
#render? ⇒ Boolean
Whether the flash block should be rendered.
23 24 25 |
# File 'app/components/railsboot/flash_component.rb', line 23 def render? @flash.present? end |