Class: Axlsx::Cols
- Inherits:
-
SimpleTypedList
- Object
- Array
- SimpleTypedList
- Axlsx::Cols
- Defined in:
- lib/axlsx/workbook/worksheet/cols.rb
Overview
The cols class manages the col object used to manage column widths. This is where the magic happens with autowidth
Instance Method Summary collapse
-
#initialize(worksheet) ⇒ Cols
constructor
A new instance of Cols.
-
#to_xml_string(str = +'')) ⇒ String
Serialize the Cols object.
Constructor Details
#initialize(worksheet) ⇒ Cols
Returns a new instance of Cols.
7 8 9 10 11 12 |
# File 'lib/axlsx/workbook/worksheet/cols.rb', line 7 def initialize(worksheet) raise ArgumentError, "you must provide a worksheet" unless worksheet.is_a?(Worksheet) super(Col) @worksheet = worksheet end |
Instance Method Details
#to_xml_string(str = +'')) ⇒ String
Serialize the Cols object
17 18 19 20 21 22 23 |
# File 'lib/axlsx/workbook/worksheet/cols.rb', line 17 def to_xml_string(str = +'') return if empty? str << '<cols>' each { |item| item.to_xml_string(str) } str << '</cols>' end |