Class: Docxer::Word::Relationships

Inherits:
Object
  • Object
show all
Defined in:
lib/docxer/word/relationships.rb,
lib/docxer/word/relationships/relationship.rb

Defined Under Namespace

Classes: Relationship

Constant Summary collapse

@@prefix =
'rId'

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeRelationships

Returns a new instance of Relationships.



10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/docxer/word/relationships.rb', line 10

def initialize
  @relationships = []
  @counter = 0
  add("http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles", "styles.xml")
  add("http://schemas.microsoft.com/office/2007/relationships/stylesWithEffects", "stylesWithEffects.xml")
  add("http://schemas.openxmlformats.org/officeDocument/2006/relationships/settings", "settings.xml")
  add("http://schemas.openxmlformats.org/officeDocument/2006/relationships/webSettings", "webSettings.xml")
  add("http://schemas.openxmlformats.org/officeDocument/2006/relationships/fontTable", "fontTable.xml")
  add("http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme", "theme/theme1.xml")
  add("http://schemas.openxmlformats.org/officeDocument/2006/relationships/endnotes", "endnotes.xml")
  add("http://schemas.openxmlformats.org/officeDocument/2006/relationships/footnotes", "footnotes.xml")
  add("http://schemas.openxmlformats.org/officeDocument/2006/relationships/numbering", "numbering.xml")
end

Instance Attribute Details

#relationshipsObject

Returns the value of attribute relationships.



8
9
10
# File 'lib/docxer/word/relationships.rb', line 8

def relationships
  @relationships
end

Instance Method Details

#add(type, target) ⇒ Object



24
25
26
27
28
# File 'lib/docxer/word/relationships.rb', line 24

def add(type, target)
  relationship = create_relationship(sequence, type, target)
  @relationships << relationship if relationship
  relationship
end

#render(zip) ⇒ Object



30
31
32
33
# File 'lib/docxer/word/relationships.rb', line 30

def render(zip)
  zip.put_next_entry('word/_rels/document.xml.rels')
  zip.write(Docxer.to_xml(document))
end