lib/axlsx/stylesheet/table_style.rb in axlsx-1.0.18 vs lib/axlsx/stylesheet/table_style.rb in axlsx-1.1.0
- old
+ new
@@ -34,15 +34,20 @@
# @see pivot
def pivot=(v) Axlsx::validate_boolean v; @pivot=v end
# @see table
def table=(v) Axlsx::validate_boolean v; @table=v end
- # Serializes the table style
- # @param [Nokogiri::XML::Builder] xml The document builder instance this objects xml will be added to.
+ # Serializes the object
+ # @param [String] str
# @return [String]
- def to_xml(xml)
+ def to_xml_string(str = '')
attr = self.instance_values.select { |k, v| [:name, :pivot, :table].include? k }
attr[:count] = self.size
- xml.tableStyle(attr) { self.each { |table_style_el| table_style_el.to_xml(xml) } }
+ str << '<tableStyle '
+ str << attr.map { |key, value| '' << key.to_s << '="' << value.to_s << '"' }.join(' ')
+ str << '>'
+ each { |table_style_el| table_style_el.to_xml_string(str) }
+ str << '</tableStyle>'
end
+
end
end