Sha256: 1fe68876cf565d422a0f7b880d533ed327bf96e1036c7fb477e9a4281f49c28a

Contents?: true

Size: 1.12 KB

Versions: 1

Compression:

Stored size: 1.12 KB

Contents

module Axlsx
  # A relationship defines a reference between package parts.
  # @note Packages automatcially manage relationships.
  class Relationship

    # The location of the relationship target
    # @return [String]
    attr_accessor :Target

    # The type of relationship
    # @note Supported types are defined as constants in Axlsx:
    # @see XML_NS_R
    # @see TABLE_R
    # @see WORKBOOK_R
    # @see WORKSHEET_R
    # @see APP_R
    # @see RELS_R
    # @see CORE_R
    # @see STYLES_R
    # @see CHART_R
    # @see DRAWING_R
    # @return [String]
    attr_accessor :Type
    def initialize(type, target)
      self.Target=target
      self.Type=type
    end

    def Target=(v) Axlsx::validate_string v; @Target = v end
    def Type=(v) Axlsx::validate_relationship_type v; @Type = v end

    # Serializes the relationship    
    # @param [Nokogiri::XML::Builder] xml The document builder instance this objects xml will be added to.
    # @param [String] rId the reference id of the object.
    # @return [String]
    def to_xml(xml, rId)
      h = self.instance_values
      h[:Id] = rId
      xml.Relationship(h)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
axlsx-1.0.8 lib/axlsx/rels/relationship.rb