summaryrefslogtreecommitdiffhomepage
path: root/lib/axlsx/rels/relationship.rb
diff options
context:
space:
mode:
authorRandy Morgan <[email protected]>2012-04-01 00:35:26 +0900
committerRandy Morgan <[email protected]>2012-04-01 00:35:26 +0900
commit22a341841f191a5aa00e87b1f166b4f25cc67f0a (patch)
tree505f46708d5cac7d33d0dd6679c125e2eb819075 /lib/axlsx/rels/relationship.rb
parentbb2117ba17297e02a0fc6d5ad5a22462e72a9a79 (diff)
downloadcaxlsx-22a341841f191a5aa00e87b1f166b4f25cc67f0a.tar.gz
caxlsx-22a341841f191a5aa00e87b1f166b4f25cc67f0a.zip
part way through changing all serialization to use string concatenation prior to dropping Nokogiri dep in production.
Diffstat (limited to 'lib/axlsx/rels/relationship.rb')
-rw-r--r--lib/axlsx/rels/relationship.rb15
1 files changed, 9 insertions, 6 deletions
diff --git a/lib/axlsx/rels/relationship.rb b/lib/axlsx/rels/relationship.rb
index 3596d808..4321c7e1 100644
--- a/lib/axlsx/rels/relationship.rb
+++ b/lib/axlsx/rels/relationship.rb
@@ -47,14 +47,17 @@ module Axlsx
# @see TargetMode
def TargetMode=(v) RestrictionValidator.validate 'Relationship.TargetMode', [:External, :Internal], v; @TargetMode = v; end
- # Serializes the relationship
- # @param [Nokogiri::XML::Builder] xml The document builder instance this objects xml will be added to.
- # @param [String] rId the reference id of the object.
+ # serialize relationship
+ # @param [String] str
+ # @param [Integer] rId the id for this relationship
# @return [String]
- def to_xml(xml, rId)
+ def to_xml_string(str = '', rId)
h = self.instance_values
- h[:Id] = rId
- xml.Relationship(h)
+ h[:Id] = 'rId' << rId.to_s
+ str << '<Relationship '
+ str << h.map { |key, value| '' << key.to_s << '="' << value.to_s << '"'}.join(' ')
+ str << '/>'
end
+
end
end