Sha256: bcbfdb8e902b7260c00e8902ac9e101a85b2433accea9206ff5be3dce4bd9d4b

Contents?: true

Size: 517 Bytes

Versions: 3

Compression:

Stored size: 517 Bytes

Contents

# frozen_string_literal: true

require 'zip'

module Docx
  module Encoder
    def self.build_new_document_xml(original_document, new_document_sections)
        output = 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
        output.string
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
docx-builder-0.1.13 lib/docx/encoder.rb
docx-builder-0.1.11 lib/docx/encoder.rb
docx-builder-0.1.8 lib/docx/encoder.rb