Class: GovukComponent::GenericHeaderComponent

Inherits:
Base
  • Object
show all
Defined in:
app/components/govuk_component/generic_header_component.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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_attributesObject (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_textObject (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

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
  @menu_button_label
end

#urlObject (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_renderObject



24
25
26
27
28
29
# File 'app/components/govuk_component/generic_header_component.rb', line 24

def before_render
  if .blank?
    fail(ArgumentError, 'logo_text missing') if logo_text.blank?
    fail(ArgumentError, 'url missing') if url.blank?
  end
end