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


10
11
12
# File 'lib/axlsx/content_type/abstract_content_type.rb', line 10

def initialize(options={})
   parse_options options
end

Instance Attribute Details

#content_typeString Also known as: ContentType

The type of content.

Returns:

  • (String)


16
17
18
# File 'lib/axlsx/content_type/abstract_content_type.rb', line 16

def content_type
  @content_type
end

Instance Method Details

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

Serialize the contenty type to xml



25
26
27
28
29
# File 'lib/axlsx/content_type/abstract_content_type.rb', line 25

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