Class: GovukComponent::TableComponent::ColGroupComponent

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

Defined Under Namespace

Classes: ColComponent

Instance Attribute Summary

Attributes inherited from Base

#html_attributes

Instance Method Summary collapse

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: classes, html_attributes: html_attributes)

  return if cols.blank?

  cols.each { |c| with_col(span: c) }
end

Instance Method Details

#callObject



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

Returns:

  • (Boolean)


16
17
18
# File 'app/components/govuk_component/table_component/col_group_component.rb', line 16

def render?
  cols.any?
end