Sha256: 1e80a3794591dbb2c7b416e19a486c1c2719d119b227e291f02333f55a70fb32

Contents?: true

Size: 768 Bytes

Versions: 1

Compression:

Stored size: 768 Bytes

Contents

# frozen_string_literal: true

module Goldendocx
  module Models
    class Relationships
      include Goldendocx::Document

      NAMESPACE = 'http://schemas.openxmlformats.org/package/2006/relationships'

      tag :Relationships
      attribute :xmlns, default: NAMESPACE, readonly: true

      embeds_many :relationships, class_name: 'Goldendocx::Models::Relationship'

      def size
        relationships.size
      end

      def write_to(zos, xml_path)
        zos.put_next_entry xml_path
        zos.write to_document_xml
      end

      def add_relationship(type, target)
        relationship_id = "rId#{relationships.size + 1}"
        build_relationship(id: relationship_id, type: type, target: target)
        relationship_id
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
goldendocx-0.2.3 lib/goldendocx/models/relationships.rb