Class: Axlsx::Relationships

Inherits:
SimpleTypedList
  • Object
show all
Defined in:
lib/axlsx/rels/relationships.rb

Overview

Note:

The package automatically manages releationships.

Relationships are a collection of Relations that define how package parts are related.

Instance Method Summary collapse

Constructor Details

#initializeRelationships

Creates a new Relationships collection based on SimpleTypedList



10
11
12
# File 'lib/axlsx/rels/relationships.rb', line 10

def initialize
  super Relationship
end

Instance Method Details

#to_xmlString

Serializes the relationships document.

Returns:

  • (String)


16
17
18
19
20
21
22
23
# File 'lib/axlsx/rels/relationships.rb', line 16

def to_xml()
  builder = Nokogiri::XML::Builder.new(:encoding => ENCODING) do |xml|
    xml.Relationships(:xmlns => Axlsx::RELS_R) {
      each_with_index { |rel, index| rel.to_xml(xml, "rId#{index+1}") }
    }
  end
  builder.to_xml(:save_with => 0)
end