Class: DsfrComponent::AccordionComponent::SectionComponent
- Inherits:
-
Base
- Object
- ViewComponent::Base
- Base
- DsfrComponent::AccordionComponent::SectionComponent
- Defined in:
- app/components/dsfr_component/accordion_component/section_component.rb
Constant Summary
Constants inherited from Base
Instance Attribute Summary collapse
-
#expanded ⇒ Object
(also: #expanded?)
readonly
Returns the value of attribute expanded.
-
#title ⇒ Object
readonly
Returns the value of attribute title.
Attributes inherited from Base
Instance Method Summary collapse
- #id ⇒ Object
-
#initialize(title:, expanded: false, id: nil, classes: [], html_attributes: {}) ⇒ SectionComponent
constructor
A new instance of SectionComponent.
Constructor Details
#initialize(title:, expanded: false, id: nil, classes: [], html_attributes: {}) ⇒ SectionComponent
Returns a new instance of SectionComponent.
9 10 11 12 13 14 15 |
# File 'app/components/dsfr_component/accordion_component/section_component.rb', line 9 def initialize(title:, expanded: false, id: nil, classes: [], html_attributes: {}) @title = title @expanded = @id = id super(classes: classes, html_attributes: html_attributes) end |
Instance Attribute Details
#expanded ⇒ Object (readonly) Also known as: expanded?
Returns the value of attribute expanded.
2 3 4 |
# File 'app/components/dsfr_component/accordion_component/section_component.rb', line 2 def @expanded end |
#title ⇒ Object (readonly)
Returns the value of attribute title.
2 3 4 |
# File 'app/components/dsfr_component/accordion_component/section_component.rb', line 2 def title @title end |
Instance Method Details
#id ⇒ Object
17 18 19 |
# File 'app/components/dsfr_component/accordion_component/section_component.rb', line 17 def id @id ||= "accordion-section-#{SecureRandom.hex(4)}" end |