Class: Axlsx::ColBreaks

Inherits:
SimpleTypedList
  • Object
show all
Defined in:
lib/axlsx/workbook/worksheet/col_breaks.rb

Overview

A collection of Brake objects. Please do not use this class directly. Instead use Worksheet#add_break

Instance Method Summary collapse

Constructor Details

#initializeColBreaks

Instantiates a new list restricted to Break types



9
10
11
# File 'lib/axlsx/workbook/worksheet/col_breaks.rb', line 9

def initialize
  super(Break)
end

Instance Method Details

#add_break(options) ⇒ Object

A column break specific helper for adding a break. The max and man options are fixed, however any other valid option for Break will be passed to the created break object.

Parameters:

  • options (Hash)

    A list of options to pass into the Break object

See Also:



18
19
20
21
# File 'lib/axlsx/workbook/worksheet/col_breaks.rb', line 18

def add_break(options)
  self << Break.new(options.merge(max: 1048575, man: true))
  last
end

#to_xml_string(str = +'')) ⇒ Object

Serialize the collection to xml

Parameters:

  • str (String) (defaults to: +''))

    The string to append this lists xml to.



28
29
30
31
32
33
34
# File 'lib/axlsx/workbook/worksheet/col_breaks.rb', line 28

def to_xml_string(str = +'')
  return if empty?

  str << '<colBreaks count="' << size.to_s << '" manualBreakCount="' << size.to_s << '">'
  each { |brk| brk.to_xml_string(str) }
  str << '</colBreaks>'
end