Class: GovukComponent::TableComponent::RowComponent
- Inherits:
-
Base
- Object
- ViewComponent::Base
- Base
- GovukComponent::TableComponent::RowComponent
- Defined in:
- app/components/govuk_component/table_component/row_component.rb
Instance Attribute Summary collapse
-
#first_cell_is_header ⇒ Object
readonly
Returns the value of attribute first_cell_is_header.
-
#parent ⇒ Object
readonly
Returns the value of attribute parent.
Attributes inherited from Base
Class Method Summary collapse
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(cell_data: nil, first_cell_is_header: false, parent: nil, classes: [], html_attributes: {}) ⇒ RowComponent
constructor
A new instance of RowComponent.
Constructor Details
#initialize(cell_data: nil, first_cell_is_header: false, parent: nil, classes: [], html_attributes: {}) ⇒ RowComponent
Returns a new instance of RowComponent.
18 19 20 21 22 23 24 25 |
# File 'app/components/govuk_component/table_component/row_component.rb', line 18 def initialize(cell_data: nil, first_cell_is_header: false, parent: nil, classes: [], html_attributes: {}) @first_cell_is_header = first_cell_is_header @parent = parent super(classes: classes, html_attributes: html_attributes) build_cells_from_cell_data(cell_data) end |
Instance Attribute Details
#first_cell_is_header ⇒ Object (readonly)
Returns the value of attribute first_cell_is_header.
16 17 18 |
# File 'app/components/govuk_component/table_component/row_component.rb', line 16 def first_cell_is_header @first_cell_is_header end |
#parent ⇒ Object (readonly)
Returns the value of attribute parent.
16 17 18 |
# File 'app/components/govuk_component/table_component/row_component.rb', line 16 def parent @parent end |
Class Method Details
.from_body(*args, **kwargs, &block) ⇒ Object
31 32 33 |
# File 'app/components/govuk_component/table_component/row_component.rb', line 31 def self.from_body(*args, **kwargs, &block) new(*args, parent: 'tbody', **kwargs, &block) end |
.from_head(*args, **kwargs, &block) ⇒ Object
27 28 29 |
# File 'app/components/govuk_component/table_component/row_component.rb', line 27 def self.from_head(*args, **kwargs, &block) new(*args, parent: 'thead', **kwargs, &block) end |
Instance Method Details
#call ⇒ Object
35 36 37 |
# File 'app/components/govuk_component/table_component/row_component.rb', line 35 def call tag.tr(**html_attributes) { safe_join(cells) } end |