Class: Axlsx::Relationship
- Inherits:
-
Object
- Object
- Axlsx::Relationship
- Defined in:
- lib/axlsx/rels/relationship.rb
Overview
Packages automatcially manage relationships.
A relationship defines a reference between package parts.
Instance Attribute Summary collapse
-
#Target ⇒ String
The location of the relationship target.
-
#TargetMode ⇒ Object
The target mode of the relationship used for hyperlink type relationships to mark the relationship to an external resource TargetMode can be specified during initialization by passing in a :target_mode option Target mode must be :external for now.
-
#Type ⇒ String
The type of relationship.
Instance Method Summary collapse
-
#initialize(type, target, options = {}) ⇒ Relationship
constructor
creates a new relationship.
-
#to_xml(xml, rId) ⇒ String
Serializes the relationship.
Constructor Details
#initialize(type, target, options = {}) ⇒ Relationship
creates a new relationship
35 36 37 38 39 |
# File 'lib/axlsx/rels/relationship.rb', line 35 def initialize(type, target, ={}) self.Target=target self.Type=type self.TargetMode = .delete(:target_mode) if [:target_mode] end |
Instance Attribute Details
#Target ⇒ String
The location of the relationship target
8 9 10 |
# File 'lib/axlsx/rels/relationship.rb', line 8 def Target @Target end |
#TargetMode ⇒ Object
The target mode of the relationship used for hyperlink type relationships to mark the relationship to an external resource TargetMode can be specified during initialization by passing in a :target_mode option Target mode must be :external for now.
29 30 31 |
# File 'lib/axlsx/rels/relationship.rb', line 29 def TargetMode @TargetMode end |
#Type ⇒ String
Supported types are defined as constants in Axlsx:
The type of relationship
23 24 25 |
# File 'lib/axlsx/rels/relationship.rb', line 23 def Type @Type end |
Instance Method Details
#to_xml(xml, rId) ⇒ String
Serializes the relationship
53 54 55 56 57 |
# File 'lib/axlsx/rels/relationship.rb', line 53 def to_xml(xml, rId) h = self.instance_values h[:Id] = rId xml.Relationship(h) end |