Class: GovukComponent::SummaryListComponent::KeyComponent

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

Instance Attribute Summary collapse

Attributes inherited from Base

#html_attributes

Attributes included from Traits::CustomHtmlAttributes

#html_attributes

Instance Method Summary collapse

Methods included from Traits::CustomClasses

#classes

Methods included from Govuk::Components::Helpers::CssUtilities

#combine_classes

Constructor Details

#initialize(text: nil, classes: [], html_attributes: {}) ⇒ KeyComponent

Returns a new instance of KeyComponent.



4
5
6
7
8
# File 'app/components/govuk_component/summary_list_component/key_component.rb', line 4

def initialize(text: nil, classes: [], html_attributes: {})
  super(classes: classes, html_attributes: html_attributes)

  @text = text
end

Instance Attribute Details

#textObject (readonly)

Returns the value of attribute text.



2
3
4
# File 'app/components/govuk_component/summary_list_component/key_component.rb', line 2

def text
  @text
end

Instance Method Details

#callObject



10
11
12
# File 'app/components/govuk_component/summary_list_component/key_component.rb', line 10

def call
  tag.dt(key_content, class: classes, **html_attributes)
end