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
- .from_body(*args, **kwargs, &block) ⇒ Object
- .from_foot(*args, **kwargs, &block) ⇒ Object
- .from_head(*args, **kwargs, &block) ⇒ Object
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.
Methods inherited from Base
Constructor Details
#initialize(cell_data: nil, first_cell_is_header: false, parent: nil, classes: [], html_attributes: {}) ⇒ RowComponent
Returns a new instance of RowComponent.
20 21 22 23 24 25 26 27 |
# File 'app/components/govuk_component/table_component/row_component.rb', line 20 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:, 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.
18 19 20 |
# File 'app/components/govuk_component/table_component/row_component.rb', line 18 def first_cell_is_header @first_cell_is_header end |
#parent ⇒ Object (readonly)
Returns the value of attribute parent.
18 19 20 |
# File 'app/components/govuk_component/table_component/row_component.rb', line 18 def parent @parent end |
Class Method Details
.from_body(*args, **kwargs, &block) ⇒ Object
33 34 35 |
# File 'app/components/govuk_component/table_component/row_component.rb', line 33 def self.from_body(*args, **kwargs, &block) new(*args, parent: 'tbody', **kwargs, &block) end |
.from_foot(*args, **kwargs, &block) ⇒ Object
37 38 39 |
# File 'app/components/govuk_component/table_component/row_component.rb', line 37 def self.from_foot(*args, **kwargs, &block) new(*args, parent: 'tfoot', **kwargs, &block) end |
.from_head(*args, **kwargs, &block) ⇒ Object
29 30 31 |
# File 'app/components/govuk_component/table_component/row_component.rb', line 29 def self.from_head(*args, **kwargs, &block) new(*args, parent: 'thead', **kwargs, &block) end |
Instance Method Details
#call ⇒ Object
41 42 43 |
# File 'app/components/govuk_component/table_component/row_component.rb', line 41 def call tag.tr(**html_attributes) { safe_join(cells) } end |