Sha256: d081d0570adfff16a788ae575c254a7e255e71d818facf33d858d6ca78cf0fb6

Contents?: true

Size: 860 Bytes

Versions: 6

Compression:

Stored size: 860 Bytes

Contents

# encoding: UTF-8
module Axlsx
require 'axlsx/rels/relationship.rb'

  # Relationships are a collection of Relations that define how package parts are related.
  # @note The package automatically manages releationships.
  class Relationships < SimpleTypedList

    # Creates a new Relationships collection based on SimpleTypedList
    def initialize
      super Relationship
    end
    
    # The relationship instance for the given source object, or nil if none exists.
    # @see Relationship#source_obj
    # @return [Relationship]
    def for(source_obj)
      find{ |rel| rel.source_obj == source_obj }
    end
    
    def to_xml_string(str = '')
      str << '<?xml version="1.0" encoding="UTF-8"?>'
      str << ('<Relationships xmlns="' << RELS_R << '">')
      each{ |rel| rel.to_xml_string(str) }
      str << '</Relationships>'
    end

  end
end

Version data entries

6 entries across 6 versions & 4 rubygems

Version Path
bonio-axlsx-2.2.3 lib/axlsx/rels/relationships.rb
bonio-axlsx-2.2.2 lib/axlsx/rels/relationships.rb
bonio-axlsx-2.2.1 lib/axlsx/rels/relationships.rb
dg-axlsx-2.1.0 lib/axlsx/rels/relationships.rb
axlsx-2.1.0.pre lib/axlsx/rels/relationships.rb
l_axlsx-2.0.1 lib/axlsx/rels/relationships.rb