Class: Goldendocx::Models::Relationships

Inherits:
Object
  • Object
show all
Includes:
Document
Defined in:
lib/goldendocx/models/relationships.rb

Constant Summary collapse

NAMESPACE =
'http://schemas.openxmlformats.org/package/2006/relationships'

Instance Method Summary collapse

Methods included from Document

#to_document_xml

Methods included from Element

#build_element, #initialize, #namespace, #tag, #tag_name, #to_element, #to_xml

Methods included from HasChildren

#children, #read_child, #read_children

Methods included from HasAttributes

#assign_attributes, #attributes, #read_attributes

Instance Method Details

#add_relationship(type, target) ⇒ Object



24
25
26
27
28
# File 'lib/goldendocx/models/relationships.rb', line 24

def add_relationship(type, target)
  relationship_id = "rId#{relationships.size + 1}"
  build_relationship(id: relationship_id, type:, target:)
  relationship_id
end

#sizeObject



15
16
17
# File 'lib/goldendocx/models/relationships.rb', line 15

def size
  relationships.size
end

#write_to(zos, xml_path) ⇒ Object



19
20
21
22
# File 'lib/goldendocx/models/relationships.rb', line 19

def write_to(zos, xml_path)
  zos.put_next_entry xml_path
  zos.write to_document_xml
end