Sha256: b855944601571c3a750035f495027ce1ebe5479f4482173182bb22c8d606e746

Contents?: true

Size: 774 Bytes

Versions: 5

Compression:

Stored size: 774 Bytes

Contents

# frozen_string_literal: true

module Axlsx
  # This class manages the serialization of rows for worksheets
  class SheetData
    # Creates a new SheetData object
    # @param [Worksheet] worksheet The worksheet that owns this sheet data.
    def initialize(worksheet)
      raise ArgumentError, "you must provide a worksheet" unless worksheet.is_a?(Worksheet)

      @worksheet = worksheet
    end

    attr_reader :worksheet

    # Serialize the sheet data
    # @param [String] str the string this objects serializaton will be concacted to.
    # @return [String]
    def to_xml_string(str = +'')
      str << '<sheetData>'
      worksheet.rows.each_with_index do |row, index|
        row.to_xml_string(index, str)
      end
      str << '</sheetData>'
    end
  end
end

Version data entries

5 entries across 5 versions & 2 rubygems

Version Path
cm-admin-1.5.22 vendor/bundle/ruby/3.3.0/gems/caxlsx-4.1.0/lib/axlsx/workbook/worksheet/sheet_data.rb
cm-admin-1.5.21 vendor/bundle/ruby/3.3.0/gems/caxlsx-4.1.0/lib/axlsx/workbook/worksheet/sheet_data.rb
cm-admin-1.5.20 vendor/bundle/ruby/3.3.0/gems/caxlsx-4.1.0/lib/axlsx/workbook/worksheet/sheet_data.rb
caxlsx-4.1.0 lib/axlsx/workbook/worksheet/sheet_data.rb
caxlsx-4.0.0 lib/axlsx/workbook/worksheet/sheet_data.rb