Class: GovukComponent::TableComponent::HeadComponent

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

Instance Attribute Summary collapse

Attributes inherited from Base

#html_attributes

Instance Method Summary collapse

Methods inherited from Base

#brand, #class_prefix

Constructor Details

#initialize(rows: nil, classes: [], html_attributes: {}) ⇒ HeadComponent

Returns a new instance of HeadComponent.



13
14
15
16
17
# File 'app/components/govuk_component/table_component/head_component.rb', line 13

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

  build_rows_from_row_data(rows)
end

Instance Attribute Details

#row_dataObject (readonly)

Returns the value of attribute row_data.



11
12
13
# File 'app/components/govuk_component/table_component/head_component.rb', line 11

def row_data
  @row_data
end

Instance Method Details

#callObject



19
20
21
# File 'app/components/govuk_component/table_component/head_component.rb', line 19

def call
  tag.thead(**html_attributes) { safe_join(rows) }
end