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