Class: GovukComponent::GenericHeaderComponent
- Inherits:
-
Base
- Object
- Base
- GovukComponent::GenericHeaderComponent
- Defined in:
- app/components/govuk_component/generic_header_component.rb
Instance Attribute Summary collapse
-
#header_html_attributes ⇒ Object
readonly
Returns the value of attribute header_html_attributes.
-
#logo_text ⇒ Object
readonly
Returns the value of attribute logo_text.
-
#menu_button_label ⇒ Object
readonly
Returns the value of attribute menu_button_label.
-
#url ⇒ Object
readonly
Returns the value of attribute url.
Instance Method Summary collapse
- #before_render ⇒ Object
-
#initialize(url: nil, logo_text: nil, classes: [], html_attributes: {}, header_html_attributes: {}) ⇒ GenericHeaderComponent
constructor
A new instance of GenericHeaderComponent.
Constructor Details
#initialize(url: nil, logo_text: nil, classes: [], html_attributes: {}, header_html_attributes: {}) ⇒ GenericHeaderComponent
Returns a new instance of GenericHeaderComponent.
11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'app/components/govuk_component/generic_header_component.rb', line 11 def initialize(url: nil, logo_text: nil, classes: [], html_attributes: {}, header_html_attributes: {}) @url = url @logo_text = logo_text @header_html_attributes = header_html_attributes super(classes:, html_attributes:) end |
Instance Attribute Details
#header_html_attributes ⇒ Object (readonly)
Returns the value of attribute header_html_attributes.
6 7 8 |
# File 'app/components/govuk_component/generic_header_component.rb', line 6 def header_html_attributes @header_html_attributes end |
#logo_text ⇒ Object (readonly)
Returns the value of attribute logo_text.
6 7 8 |
# File 'app/components/govuk_component/generic_header_component.rb', line 6 def logo_text @logo_text end |
#menu_button_label ⇒ Object (readonly)
Returns the value of attribute menu_button_label.
6 7 8 |
# File 'app/components/govuk_component/generic_header_component.rb', line 6 def @menu_button_label end |
#url ⇒ Object (readonly)
Returns the value of attribute url.
6 7 8 |
# File 'app/components/govuk_component/generic_header_component.rb', line 6 def url @url end |
Instance Method Details
#before_render ⇒ Object
24 25 26 27 28 29 |
# File 'app/components/govuk_component/generic_header_component.rb', line 24 def before_render if logo.blank? fail(ArgumentError, 'logo_text missing') if logo_text.blank? fail(ArgumentError, 'url missing') if url.blank? end end |