Class: GovukComponent::TableComponent::FootComponent

Inherits:
Base
  • Object
show all
Defined in:
app/components/govuk_component/table_component/foot_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, first_cell_is_header: false, classes: [], html_attributes: {}) ⇒ FootComponent

Returns a new instance of FootComponent.



14
15
16
17
18
19
20
21
22
23
# File 'app/components/govuk_component/table_component/foot_component.rb', line 14

def initialize(rows: nil, first_cell_is_header: false, classes: [], html_attributes: {})
  @rows = rows
  @first_cell_is_header = first_cell_is_header

  super(classes:, html_attributes:)

  return unless rows.presence

  build_rows_from_row_data(rows)
end

Instance Attribute Details

#first_cell_is_headerObject (readonly)

Returns the value of attribute first_cell_is_header.



12
13
14
# File 'app/components/govuk_component/table_component/foot_component.rb', line 12

def first_cell_is_header
  @first_cell_is_header
end

#row_dataObject (readonly)

Returns the value of attribute row_data.



12
13
14
# File 'app/components/govuk_component/table_component/foot_component.rb', line 12

def row_data
  @row_data
end

Instance Method Details

#callObject



25
26
27
# File 'app/components/govuk_component/table_component/foot_component.rb', line 25

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

#render?Boolean

Returns:

  • (Boolean)


29
30
31
# File 'app/components/govuk_component/table_component/foot_component.rb', line 29

def render?
  rows.any?
end