Class: CCS::Components::GovUK::Table::Body::HeadCell

Inherits:
Base
  • Object
show all
Defined in:
lib/ccs/components/govuk/table/body/head_cell.rb

Overview

GOV.UK Table Body head cell

The individual table body head cell

Constant Summary collapse

DEFAULT_ATTRIBUTES =

The default attributes for the table body head cell

{ class: 'govuk-table__header' }.freeze

Instance Method Summary collapse

Constructor Details

#initialize(text:) ⇒ HeadCell

Returns a new instance of HeadCell.

Parameters:

  • text (String)

    the text of the cell

  • options (Hash)

    options that will be used in customising the HTML


28
29
30
31
32
33
34
# File 'lib/ccs/components/govuk/table/body/head_cell.rb', line 28

def initialize(text:, **)
  super(**)

  @options[:attributes][:scope] = 'row'

  @text = text
end

Instance Method Details

#renderActiveSupport::SafeBuffer

Generates the HTML for the GOV.UK Table Body head cell

Returns:

  • (ActiveSupport::SafeBuffer)

40
41
42
# File 'lib/ccs/components/govuk/table/body/head_cell.rb', line 40

def render
  tag.th(text, **options[:attributes])
end