Class: Axlsx::Override
- Inherits:
-
Object
- Object
- Axlsx::Override
- Defined in:
- lib/axlsx/content_type/override.rb
Overview
An override content part. These parts are automatically created by for you based on the content of your package.
Instance Attribute Summary collapse
-
#content_type ⇒ String
(also: #ContentType)
The type of content.
-
#part_name ⇒ String
(also: #PartName)
The name and location of the part.
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ Override
constructor
Creates a new Override object.
-
#to_xml_string(str = '') ⇒ String
Serializes the object.
Constructor Details
#initialize(options = {}) ⇒ Override
Creates a new Override object
20 21 22 23 24 25 |
# File 'lib/axlsx/content_type/override.rb', line 20 def initialize(={}) raise ArgumentError, "PartName and ContentType are required" unless ([:PartName] || [:part_name]) && ([:ContentType] || [:content_type]) .each do |o| self.send("#{o[0]}=", o[1]) if self.respond_to? "#{o[0]}=" end end |
Instance Attribute Details
#content_type ⇒ String Also known as: ContentType
The type of content.
8 9 10 |
# File 'lib/axlsx/content_type/override.rb', line 8 def content_type @content_type end |
#part_name ⇒ String Also known as: PartName
The name and location of the part.
13 14 15 |
# File 'lib/axlsx/content_type/override.rb', line 13 def part_name @part_name end |
Instance Method Details
#to_xml_string(str = '') ⇒ String
Serializes the object
39 40 41 42 43 |
# File 'lib/axlsx/content_type/override.rb', line 39 def to_xml_string(str = '') str << '<Override ' str << instance_values.map { |key, value| '' << Axlsx::camel(key) << '="' << value.to_s << '"' }.join(' ') str << '/>' end |