Sha256: 25a0111ba966d5824b87310bc49eda90100ca85f96684367d2bef6747bad54ba

Contents?: true

Size: 559 Bytes

Versions: 7

Compression:

Stored size: 559 Bytes

Contents

# frozen_string_literal: true

module Docx
  module Builder
    # Rebuild the docx file using the new xml strings for header and document
    module Encoder
      def self.build_docx_buffer(original_document, new_document_sections)
        Zip::OutputStream.write_buffer(StringIO.new) do |out|
          original_document.each do |entry|
            entry_name = entry.name
            out.put_next_entry(entry_name)
            out.write(new_document_sections[entry_name] || entry.get_input_stream.read)
          end
        end
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
docx-builder-0.6.0 lib/docx/builder/encoder.rb
docx-builder-0.5.0 lib/docx/builder/encoder.rb
docx-builder-0.4.1 lib/docx/builder/encoder.rb
docx-builder-0.4.1.pre.alpha lib/docx/builder/encoder.rb
docx-builder-0.4.0 lib/docx/builder/encoder.rb
docx-builder-0.3.1 lib/docx/builder/encoder.rb
docx-builder-0.3.0 lib/docx/builder/encoder.rb