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.
-
#starting_header_level ⇒ Object
readonly
Returns the value of attribute starting_header_level.
-
#title ⇒ Object
readonly
Returns the value of attribute title.
Attributes inherited from Base
Instance Method Summary collapse
- #id ⇒ Object
-
#initialize(title:, starting_header_level:, expanded: false, id: nil, classes: [], html_attributes: {}) ⇒ SectionComponent
constructor
A new instance of SectionComponent.
Constructor Details
#initialize(title:, starting_header_level:, expanded: false, id: nil, classes: [], html_attributes: {}) ⇒ SectionComponent
Returns a new instance of SectionComponent.
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'app/components/dsfr_component/accordion_component/section_component.rb', line 9 def initialize( title:, starting_header_level:, expanded: false, id: nil, classes: [], html_attributes: {} ) @title = title = @id = id @starting_header_level = starting_header_level 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 end |
#starting_header_level ⇒ Object (readonly)
Returns the value of attribute starting_header_level.
2 3 4 |
# File 'app/components/dsfr_component/accordion_component/section_component.rb', line 2 def starting_header_level @starting_header_level 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
25 26 27 |
# File 'app/components/dsfr_component/accordion_component/section_component.rb', line 25 def id @id ||= "accordion-section-#{SecureRandom.hex(4)}" end |