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

Methods inherited from Base

#brand, #class_prefix

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

#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