Sha256: 682ff2d1f058c0aca8472e441f67f53700d2f2a37413211dbd750ae4e079034a
Contents?: true
Size: 1.91 KB
Versions: 1
Compression:
Stored size: 1.91 KB
Contents
# encoding: UTF-8 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_reader :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_reader :Type # The target mode of the relationship # used for hyperlink type relationships to mark the relationship to an external resource # TargetMode can be specified during initialization by passing in a :target_mode option # Target mode must be :external for now. attr_reader :TargetMode # creates a new relationship # @param [String] Type The type of the relationship # @param [String] Target The target for the relationship # @option [Symbol] target_mode only accepts :external. def initialize(type, target, options={}) self.Target=target self.Type=type self.TargetMode = options.delete(:target_mode) if options[:target_mode] end # @see Target def Target=(v) Axlsx::validate_string v; @Target = v end # @see Type def Type=(v) Axlsx::validate_relationship_type v; @Type = v end # @see TargetMode def TargetMode=(v) RestrictionValidator.validate 'Relationship.TargetMode', [:External, :Internal], v; @TargetMode = 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.17 | lib/axlsx/rels/relationship.rb |