Class: PowerPointer::ContentTypes

Inherits:
Object
  • Object
show all
Defined in:
lib/powerpointer/content_types.rb,
lib/powerpointer/content_types/default.rb,
lib/powerpointer/content_types/override.rb

Defined Under Namespace

Classes: Default, Override

Instance Method Summary collapse

Constructor Details

#initializeContentTypes

Returns a new instance of ContentTypes.



3
4
5
# File 'lib/powerpointer/content_types.rb', line 3

def initialize
    @contentTypes = []
end

Instance Method Details

#add_content_type(ct) ⇒ Object



7
8
9
10
11
# File 'lib/powerpointer/content_types.rb', line 7

def add_content_type(ct)
    if ct.respond_to?(:to_xml)
        @contentTypes << ct
    end
end

#export_xml(folder, package) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/powerpointer/content_types.rb', line 13

def export_xml(folder, package)
    # Export me

    export = ExportFile.new(folder, "[Content_Types].xml")
    export << "<Types xmlns=\"http://schemas.openxmlformats.org/package/2006/content-types\">"
    @contentTypes.each do |contentType|
        export << contentType.to_xml
    end
    export << "</Types>"
    package.add export
    
    # Content Types is a hardcoded file. No need to add references.

end