Class: GovukComponent::TableComponent::CellComponent

Inherits:
Base
  • Object
show all
Defined in:
app/components/govuk_component/table_component/cell_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(scope: nil, header: nil, numeric: false, text: nil, width: nil, parent: nil, rowspan: nil, colspan: nil, classes: [], html_attributes: {}) ⇒ CellComponent

Returns a new instance of CellComponent.



7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'app/components/govuk_component/table_component/cell_component.rb', line 7

def initialize(scope: nil, header: nil, numeric: false, text: nil, width: nil, parent: nil, rowspan: nil, colspan: nil, classes: [], html_attributes: {})
  @text    = text
  @numeric = numeric
  @width   = width
  @scope   = scope
  @parent  = parent
  @colspan = colspan
  @rowspan = rowspan
  @header  = (header.nil?) ? in_thead? : header
  @width   = widths.fetch(width, nil)

  super(classes:, html_attributes:)
end

Instance Attribute Details

#colspanObject (readonly)

Returns the value of attribute colspan.



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

def colspan
  @colspan
end

#headerObject (readonly) Also known as: header?

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

#parentObject (readonly)

Returns the value of attribute parent.



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

def parent
  @parent
end

#rowspanObject (readonly)

Returns the value of attribute rowspan.



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

def rowspan
  @rowspan
end

#scopeObject (readonly)

Returns the value of attribute scope.



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

def scope
  @scope
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



21
22
23
# File 'app/components/govuk_component/table_component/cell_component.rb', line 21

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