Class: GovukComponent::Header::Item
- Defined in:
- app/components/govuk_component/header.rb
Instance Attribute Summary collapse
-
#active ⇒ Object
Returns the value of attribute active.
-
#href ⇒ Object
Returns the value of attribute href.
-
#title ⇒ Object
Returns the value of attribute title.
Attributes included from Traits::CustomHtmlAttributes
Instance Method Summary collapse
- #active? ⇒ Boolean
- #active_class ⇒ Object
-
#initialize(title:, href:, active: false, classes: [], html_attributes: {}) ⇒ Item
constructor
A new instance of Item.
Methods included from Traits::CustomClasses
Constructor Details
#initialize(title:, href:, active: false, classes: [], html_attributes: {}) ⇒ Item
Returns a new instance of Item.
27 28 29 30 31 32 33 |
# File 'app/components/govuk_component/header.rb', line 27 def initialize(title:, href:, active: false, classes: [], html_attributes: {}) super(classes: classes, html_attributes: html_attributes) self.title = title self.href = href self.active = active end |
Instance Attribute Details
#active ⇒ Object
Returns the value of attribute active.
25 26 27 |
# File 'app/components/govuk_component/header.rb', line 25 def active @active end |
#href ⇒ Object
Returns the value of attribute href.
25 26 27 |
# File 'app/components/govuk_component/header.rb', line 25 def href @href end |
#title ⇒ Object
Returns the value of attribute title.
25 26 27 |
# File 'app/components/govuk_component/header.rb', line 25 def title @title end |
Instance Method Details
#active? ⇒ Boolean
35 36 37 |
# File 'app/components/govuk_component/header.rb', line 35 def active? active end |
#active_class ⇒ Object
39 40 41 |
# File 'app/components/govuk_component/header.rb', line 39 def active_class %w(govuk-header__navigation-item--active) if active? end |