Sha256: 00a00f3f500f1faf9dac6ae28d558387ba04b5d2db09efe9a467e2ef847340e1

Contents?: true

Size: 1.26 KB

Versions: 8

Compression:

Stored size: 1.26 KB

Contents

module Axlsx
  # An override content part. These parts are automatically created by for you based on the content of your package.
  class Override

    # The type of content.
    # @return [String] 
    attr_reader :ContentType

    # The name and location of the part.
    # @return [String] 
    attr_reader :PartName

    #Creates a new Override object
    # @option options [String] PartName
    # @option options [String] ContentType
    # @raise [ArgumentError] An argument error is raised if both PartName and ContentType are not specified.
    def initialize(options={})
      raise ArgumentError, "PartName and ContentType are required" unless options[:PartName] && options[:ContentType]
      options.each do |o|
        self.send("#{o[0]}=", o[1]) if self.respond_to? "#{o[0]}="
      end      
    end

    # The name and location of the part.
    def PartName=(v) Axlsx::validate_string v; @PartName = v end

    # The content type. 
    # @see Axlsx#validate_content_type
    def ContentType=(v) Axlsx::validate_content_type v; @ContentType = v end

    # Serializes the Override object to xml
    # @param [Nokogiri::XML::Builder] xml The document builder instance this objects xml will be added to.
    def to_xml(xml)
      xml.Override(self.instance_values)
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
axlsx-1.0.16 lib/axlsx/content_type/override.rb
axlsx-1.0.15 lib/axlsx/content_type/override.rb
axlsx-1.0.14 lib/axlsx/content_type/override.rb
axlsx-1.0.13 lib/axlsx/content_type/override.rb
axlsx-1.0.11 lib/axlsx/content_type/override.rb
axlsx-1.0.10 lib/axlsx/content_type/override.rb
axlsx-1.0.10a lib/axlsx/content_type/override.rb
axlsx-1.0.9 lib/axlsx/content_type/override.rb