Class: GovukComponent::TableComponent::CellComponent

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

Constant Summary collapse

WIDTHS =
{
  "full"           => "govuk-!-width-full",
  "three-quarters" => "govuk-!-width-three-quarters",
  "two-thirds"     => "govuk-!-width-two-thirds",
  "one-half"       => "govuk-!-width-one-half",
  "one-third"      => "govuk-!-width-one-third",
  "one-quarter"    => "govuk-!-width-one-quarter",
}.freeze

Instance Attribute Summary collapse

Attributes inherited from Base

#html_attributes

Instance Method Summary collapse

Constructor Details

#initialize(header: false, text: nil, numeric: false, width: nil, classes: [], html_attributes: {}) ⇒ CellComponent

Returns a new instance of CellComponent.



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

def initialize(header: false, text: nil, numeric: false, width: nil, classes: [], html_attributes: {})
  @header  = header
  @text    = text
  @numeric = numeric
  @width   = width

  super(classes: classes, html_attributes: html_attributes)
end

Instance Attribute Details

#headerObject (readonly)

Returns the value of attribute header.



2
3
4
# File 'app/components/govuk_component/table_component/cell_component.rb', line 2

def header
  @header
end

#numericObject (readonly) Also known as: numeric?

Returns the value of attribute numeric.



2
3
4
# File 'app/components/govuk_component/table_component/cell_component.rb', line 2

def numeric
  @numeric
end

#textObject (readonly)

Returns the value of attribute text.



2
3
4
# File 'app/components/govuk_component/table_component/cell_component.rb', line 2

def text
  @text
end

#widthObject (readonly)

Returns the value of attribute width.



2
3
4
# File 'app/components/govuk_component/table_component/cell_component.rb', line 2

def width
  @width
end

Instance Method Details

#callObject



24
25
26
# File 'app/components/govuk_component/table_component/cell_component.rb', line 24

def call
  (cell_element, cell_content, **html_attributes)
end