lib/axlsx/doc_props/app.rb in axlsx-1.3.1 vs lib/axlsx/doc_props/app.rb in axlsx-1.3.2
- old
+ new
@@ -9,10 +9,12 @@
# TitlesOfParts (VectorLpstr),
# HLinks (VectorVariant),
# DigSig (DigSigBlob)
class App
+ include Axlsx::OptionsParser
+
# Creates an App object
# @option options [String] template
# @option options [String] manager
# @option options [Integer] pages
# @option options [Integer] words
@@ -33,13 +35,11 @@
# @option options [String] hyperlinks_changed
# @option options [String] application
# @option options [String] app_version
# @option options [Integer] doc_security
def initialize(options={})
- options.each do |name, value|
- self.send("#{name}=", value) if self.respond_to? "#{name}="
- end
+ parse_options options
end
# @return [String] The name of the document template.
attr_reader :template
alias :Template :template
@@ -221,10 +221,13 @@
# Serialize the app.xml document
# @return [String]
def to_xml_string(str = '')
str << '<?xml version="1.0" encoding="UTF-8"?>'
str << '<Properties xmlns="' << APP_NS << '" xmlns:vt="' << APP_NS_VT << '">'
- str << instance_values.map { |key, value| '<' << Axlsx.camel(key) << '>' << value.to_s << '</' << Axlsx.camel(key) << '>' }.join
+ instance_values.each do |key, value|
+ node_name = Axlsx.camel(key)
+ str << "<#{node_name}>#{value}</#{node_name}>"
+ end
str << '</Properties>'
end
end