Class: DsfrComponent::BadgeComponent
- Inherits:
-
Base
- Object
- Base
- DsfrComponent::BadgeComponent
- Defined in:
- app/components/dsfr_component/badge_component.rb
Constant Summary collapse
- STATUSES =
%i[success error info warning new].freeze
- SIZES =
%i[md sm].freeze
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(status: nil, size: :md, html_attributes: {}) ⇒ BadgeComponent
constructor
A new instance of BadgeComponent.
Constructor Details
#initialize(status: nil, size: :md, html_attributes: {}) ⇒ BadgeComponent
Returns a new instance of BadgeComponent.
7 8 9 10 11 12 13 14 15 |
# File 'app/components/dsfr_component/badge_component.rb', line 7 def initialize(status: nil, size: :md, html_attributes: {}) validate_status!(status) validate_size!(size) @status = status @size = size super(html_attributes: html_attributes) end |
Instance Method Details
#call ⇒ Object
17 18 19 20 21 |
# File 'app/components/dsfr_component/badge_component.rb', line 17 def call tag.div(**html_attributes) do content end end |