Class: GovukComponent::LanguageNavigationComponent::Item

Inherits:
Base
  • Object
show all
Includes:
GovukVisuallyHiddenHelper
Defined in:
app/components/govuk_component/language_navigation_component.rb

Instance Attribute Summary collapse

Attributes inherited from Base

#html_attributes

Instance Method Summary collapse

Methods included from GovukVisuallyHiddenHelper

#govuk_visually_hidden

Methods inherited from Base

#brand, #class_prefix

Constructor Details

#initialize(text:, lang:, href: nil, language_description_text: nil, current: false, href_lang: nil, dir: 'ltr', any_rtl: false, classes: [], html_attributes: {}) ⇒ Item

Returns a new instance of Item.



45
46
47
48
49
50
51
52
53
54
55
# File 'app/components/govuk_component/language_navigation_component.rb', line 45

def initialize(text:, lang:, href: nil, language_description_text: nil, current: false, href_lang: nil, dir: 'ltr', any_rtl: false, classes: [], html_attributes: {})
  @text = text
  @lang = lang
  @href = href
  @href_lang = href_lang || lang
  @current = current
  @language_description_text = language_description_text
  @dir = dir if any_rtl

  super(classes:, html_attributes:)
end

Instance Attribute Details

#any_rtlObject (readonly)

Returns the value of attribute any_rtl.



43
44
45
# File 'app/components/govuk_component/language_navigation_component.rb', line 43

def any_rtl
  @any_rtl
end

#currentObject (readonly)

Returns the value of attribute current.



43
44
45
# File 'app/components/govuk_component/language_navigation_component.rb', line 43

def current
  @current
end

#dirObject (readonly)

Returns the value of attribute dir.



43
44
45
# File 'app/components/govuk_component/language_navigation_component.rb', line 43

def dir
  @dir
end

#hrefObject (readonly)

Returns the value of attribute href.



43
44
45
# File 'app/components/govuk_component/language_navigation_component.rb', line 43

def href
  @href
end

#href_langObject (readonly)

Returns the value of attribute href_lang.



43
44
45
# File 'app/components/govuk_component/language_navigation_component.rb', line 43

def href_lang
  @href_lang
end

#langObject (readonly)

Returns the value of attribute lang.



43
44
45
# File 'app/components/govuk_component/language_navigation_component.rb', line 43

def lang
  @lang
end

#language_description_textObject (readonly)

Returns the value of attribute language_description_text.



43
44
45
# File 'app/components/govuk_component/language_navigation_component.rb', line 43

def language_description_text
  @language_description_text
end

#textObject (readonly)

Returns the value of attribute text.



43
44
45
# File 'app/components/govuk_component/language_navigation_component.rb', line 43

def text
  @text
end

Instance Method Details

#callObject



57
58
59
# File 'app/components/govuk_component/language_navigation_component.rb', line 57

def call
  tag.li(content, **default_attributes)
end