Class: GovukComponent::TableComponent::ColGroupComponent
- Inherits:
-
Base
- Object
- ViewComponent::Base
- Base
- GovukComponent::TableComponent::ColGroupComponent
- Defined in:
- app/components/govuk_component/table_component/col_group_component.rb
Defined Under Namespace
Classes: ColComponent
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(classes: [], cols: [], html_attributes: {}) ⇒ ColGroupComponent
constructor
A new instance of ColGroupComponent.
- #render? ⇒ Boolean
Methods inherited from Base
Constructor Details
#initialize(classes: [], cols: [], html_attributes: {}) ⇒ ColGroupComponent
Returns a new instance of ColGroupComponent.
4 5 6 7 8 9 10 |
# File 'app/components/govuk_component/table_component/col_group_component.rb', line 4 def initialize(classes: [], cols: [], html_attributes: {}) super(classes:, html_attributes:) return if cols.blank? cols.each { |c| with_col(span: c) } end |
Instance Method Details
#call ⇒ Object
12 13 14 |
# File 'app/components/govuk_component/table_component/col_group_component.rb', line 12 def call tag.colgroup(**html_attributes) { safe_join(cols) } end |
#render? ⇒ Boolean
16 17 18 |
# File 'app/components/govuk_component/table_component/col_group_component.rb', line 16 def render? cols.any? end |