Class: Axlsx::Default
- Inherits:
-
Object
- Object
- Axlsx::Default
- Defined in:
- lib/axlsx/content_type/default.rb
Overview
An default content part. These parts are automatically created by for you based on the content of your package.
Instance Attribute Summary collapse
-
#ContentType ⇒ String
The type of content.
-
#Extension ⇒ String
The extension of the content type.
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ Default
constructor
Creates a new Default object.
-
#to_xml_string(str = '') ⇒ String
Serializes the object.
Constructor Details
#initialize(options = {}) ⇒ Default
Creates a new Default object
18 19 20 21 22 23 |
# File 'lib/axlsx/content_type/default.rb', line 18 def initialize(={}) raise ArgumentError, "Extension and ContentType are required" unless [:Extension] && [:ContentType] .each do |o| self.send("#{o[0]}=", o[1]) if self.respond_to? "#{o[0]}=" end end |
Instance Attribute Details
#ContentType ⇒ String
The type of content.
12 13 14 |
# File 'lib/axlsx/content_type/default.rb', line 12 def ContentType @ContentType end |
#Extension ⇒ String
The extension of the content type.
8 9 10 |
# File 'lib/axlsx/content_type/default.rb', line 8 def Extension @Extension end |
Instance Method Details
#to_xml_string(str = '') ⇒ String
Serializes the object
34 35 36 37 38 |
# File 'lib/axlsx/content_type/default.rb', line 34 def to_xml_string(str = '') str << '<Default ' str << instance_values.map { |key, value| '' << key.to_s << '="' << value.to_s << '"' }.join(' ') str << '/>' end |