Class: Railsboot::FlashComponent

Inherits:
Component
  • Object
show all
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

Constructor Details

#initialize(flash:, **html_attributes) ⇒ FlashComponent

Returns a new instance of FlashComponent.



13
14
15
16
# File 'app/components/railsboot/flash_component.rb', line 13

def initialize(flash:, **html_attributes)
  @flash = flash
  @html_attributes = html_attributes
end

Instance Method Details

#render?Boolean

Returns:

  • (Boolean)


18
19
20
# File 'app/components/railsboot/flash_component.rb', line 18

def render?
  @flash.present?
end