diff options
| author | Randy Morgan <[email protected]> | 2012-04-01 11:58:09 +0900 |
|---|---|---|
| committer | Randy Morgan <[email protected]> | 2012-04-01 11:58:09 +0900 |
| commit | 1529fce32449a8454208fded20d83c9ceca810e0 (patch) | |
| tree | 02f722182fea58a51b8c0a5433221b3a677e80e4 /lib/axlsx/drawing/cat_axis_data.rb | |
| parent | 22a341841f191a5aa00e87b1f166b4f25cc67f0a (diff) | |
| download | caxlsx-1529fce32449a8454208fded20d83c9ceca810e0.tar.gz caxlsx-1529fce32449a8454208fded20d83c9ceca810e0.zip | |
rebuild all serialization to use string concatenation instead of nokogiri.
Diffstat (limited to 'lib/axlsx/drawing/cat_axis_data.rb')
| -rw-r--r-- | lib/axlsx/drawing/cat_axis_data.rb | 38 |
1 files changed, 9 insertions, 29 deletions
diff --git a/lib/axlsx/drawing/cat_axis_data.rb b/lib/axlsx/drawing/cat_axis_data.rb index a119282e..ced5a305 100644 --- a/lib/axlsx/drawing/cat_axis_data.rb +++ b/lib/axlsx/drawing/cat_axis_data.rb @@ -13,38 +13,18 @@ module Axlsx def to_xml_string(str = '') - str << '<cat>' - str << '<strRef>' - str << '<f>' << Axlsx::cell_range(@list) << '</f>' - str << '<strCache>' - str << '<ptCount val="' << size.to_s << '"/>' + str << '<c:cat>' + str << '<c:strRef>' + str << '<c:f>' << Axlsx::cell_range(@list) << '</c:f>' + str << '<c:strCache>' + str << '<c:ptCount val="' << size.to_s << '"/>' each_with_index do |item, index| v = item.is_a?(Cell) ? item.value.to_s : item - str << '<pt idx="' << index.to_s << '"><v>' << v << '</v></pt>' + str << '<c:pt idx="' << index.to_s << '"><c:v>' << v << '</c:v></c:pt>' end - str << '</strCache>' - str << '</strRef>' - str << '</cat>' - end - - # Serializes the category axis data - # @param [Nokogiri::XML::Builder] xml The document builder instance this objects xml will be added to. - # @return [String] - def to_xml(xml) - xml.cat { - xml.strRef { - xml.f Axlsx::cell_range(@list) - xml.strCache { - xml.ptCount :val=>size - each_with_index do |item, index| - v = item.is_a?(Cell) ? item.value : item - xml.pt(:idx=>index) { - xml.v v - } - end - } - } - } + str << '</c:strCache>' + str << '</c:strRef>' + str << '</c:cat>' end end |
