summaryrefslogtreecommitdiffhomepage
path: root/lib/axlsx/content_type/content_type.rb
blob: d2e3bb9ef5398b0ca1efc49630a4cf1493083a86 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# frozen_string_literal: true

module Axlsx
  require 'axlsx/content_type/abstract_content_type'
  require 'axlsx/content_type/default'
  require 'axlsx/content_type/override'

  # ContentTypes used in the package. This is automatically managed by the package package.
  class ContentType < SimpleTypedList
    def initialize
      super [Override, Default]
    end

    # Serializes the object
    # @param [String] str
    # @return [String]
    def to_xml_string(str = +'')
      str << '<?xml version="1.0" encoding="UTF-8"?>'
      str << '<Types xmlns="' << XML_NS_T << '">'
      each { |type| type.to_xml_string(str) }
      str << '</Types>'
    end
  end
end