Class: NoticeComponent
- Inherits:
-
ViewComponent::Base
- Object
- ViewComponent::Base
- NoticeComponent
- Defined in:
- lib/alveole/components/notice_component.rb
Constant Summary collapse
- TYPES =
%w[notice alert].freeze
Instance Method Summary collapse
-
#initialize(title:, messages: [], type: nil) ⇒ NoticeComponent
constructor
A new instance of NoticeComponent.
- #render? ⇒ Boolean
Constructor Details
#initialize(title:, messages: [], type: nil) ⇒ NoticeComponent
Returns a new instance of NoticeComponent.
3 4 5 6 7 8 9 10 |
# File 'lib/alveole/components/notice_component.rb', line 3 def initialize(title:, messages: [], type: nil) super @type = type if TYPES.include?(type) @type ||= 'alert' @title = title @messages = end |
Instance Method Details
#render? ⇒ Boolean
12 13 14 |
# File 'lib/alveole/components/notice_component.rb', line 12 def render? @messages.any? end |