lib/axlsx/stylesheet/table_style_element.rb in axlsx-1.0.18 vs lib/axlsx/stylesheet/table_style_element.rb in axlsx-1.1.0

- old
+ new

@@ -1,9 +1,9 @@ # encoding: UTF-8 module Axlsx - # an element of style that belongs to a table style. - # @note tables and table styles are not supported in this version. This class exists in preparation for that support. + # an element of style that belongs to a table style. + # @note tables and table styles are not supported in this version. This class exists in preparation for that support. class TableStyleElement # The type of style element. The following type are allowed # :wholeTable # :headerRow # :totalRow @@ -37,11 +37,11 @@ # Number of rows or columns used in striping when the type is firstRowStripe, secondRowStripe, firstColumnStripe, or secondColumnStripe. # @return [Integer] attr_reader :size - # The dxfId this style element points to + # The dxfId this style element points to # @return [Integer] attr_reader :dxfId # creates a new TableStyleElement object # @option options [Symbol] type @@ -60,13 +60,16 @@ def size=(v) Axlsx::validate_unsigned_int v; @size = v end # @see dxfId def dxfId=(v) Axlsx::validate_unsigned_int v; @dxfId = v end - # Serializes the table style element - # @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) - xml.tableStyleElement self.instance_values + def to_xml_string(str = '') + str << '<tableStyleElement ' + str << instance_values.map { |key, value| '' << key.to_s << '="' << value.to_s << '"' }.join(' ') + str << '/>' end + end end