Class: Axlsx::Relationships
- Inherits:
-
SimpleTypedList
- Object
- Array
- SimpleTypedList
- Axlsx::Relationships
- Defined in:
- lib/axlsx/rels/relationships.rb
Overview
Note:
The package automatically manages relationships.
Relationships are a collection of Relations that define how package parts are related.
Instance Method Summary collapse
-
#for(source_obj) ⇒ Relationship
The relationship instance for the given source object, or nil if none exists.
-
#initialize ⇒ Relationships
constructor
Creates a new Relationships collection based on SimpleTypedList.
-
#to_xml_string(str = +'')) ⇒ String
serialize relationships.
Constructor Details
#initialize ⇒ Relationships
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
#for(source_obj) ⇒ Relationship
The relationship instance for the given source object, or nil if none exists.
17 18 19 |
# File 'lib/axlsx/rels/relationships.rb', line 17 def for(source_obj) find { |rel| rel.source_obj == source_obj } end |
#to_xml_string(str = +'')) ⇒ String
serialize relationships
24 25 26 27 28 29 |
# File 'lib/axlsx/rels/relationships.rb', line 24 def to_xml_string(str = +'') str << '<?xml version="1.0" encoding="UTF-8"?>' str << '<Relationships xmlns="' << RELS_R << '">' each { |rel| rel.to_xml_string(str) } str << '</Relationships>' end |