Class: CCS::Components::GovUK::Table::Header::HeadCell
- Defined in:
- lib/ccs/components/govuk/table/header/head_cell.rb
Overview
GOV.UK Table Header head cell
The individual table header head cell
Constant Summary collapse
- DEFAULT_ATTRIBUTES =
The default attributes for the table header head cell
{ class: 'govuk-table__header' }.freeze
Instance Method Summary collapse
-
#initialize(text:, **options) ⇒ HeadCell
constructor
A new instance of HeadCell.
-
#render ⇒ ActiveSupport::SafeBuffer
Generates the HTML for the GOV.UK Table Header head cell.
Constructor Details
#initialize(text:, **options) ⇒ HeadCell
Returns a new instance of HeadCell.
29 30 31 32 33 34 35 36 |
# File 'lib/ccs/components/govuk/table/header/head_cell.rb', line 29 def initialize(text:, **) super(**) @options[:attributes][:class] += " govuk-table__header--#{@options[:format]}" if @options[:format] @options[:attributes][:scope] = 'col' @text = text end |
Instance Method Details
#render ⇒ ActiveSupport::SafeBuffer
Generates the HTML for the GOV.UK Table Header head cell
42 43 44 |
# File 'lib/ccs/components/govuk/table/header/head_cell.rb', line 42 def render tag.th(text, **[:attributes]) end |