Class: Railsboot::FlashComponent

Inherits:
Component
  • Object
show all
Defined in:
app/components/railsboot/flash_component.rb

Constant Summary collapse

FLASH_TYPES =
[:notice, :alert, :info].freeze
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.



9
10
11
12
# File 'app/components/railsboot/flash_component.rb', line 9

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

Instance Method Details

#render?Boolean

Returns:

  • (Boolean)


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

def render?
  @flash.present?
end