Class: Axlsx::AbstractContentType

Inherits:
Object
  • Object
show all
Includes:
OptionsParser
Defined in:
lib/axlsx/content_type/abstract_content_type.rb

Overview

This class extracts the common parts from Default and Override

Direct Known Subclasses

Default, Override

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from OptionsParser

#parse_options

Constructor Details

#initialize(options = {}) ⇒ AbstractContentType

Initializes an abstract content type

See Also:

  • Override


8
9
10
# File 'lib/axlsx/content_type/abstract_content_type.rb', line 8

def initialize(options = {})
  parse_options options
end

Instance Attribute Details

#content_typeString Also known as: ContentType

The type of content.

Returns:

  • (String)


14
15
16
# File 'lib/axlsx/content_type/abstract_content_type.rb', line 14

def content_type
  @content_type
end

Instance Method Details

#to_xml_string(node_name = '', str = '') ⇒ Object

Serialize the contenty type to xml



23
24
25
26
27
# File 'lib/axlsx/content_type/abstract_content_type.rb', line 23

def to_xml_string(node_name = '', str = '')
  str << "<#{node_name} "
  str << Axlsx.instance_values_for(self).map { |key, value| Axlsx::camel(key) << '="' << value.to_s << '"' }.join(' ')
  str << '/>'
end