summaryrefslogtreecommitdiffhomepage
path: root/lib/axlsx/content_type
diff options
context:
space:
mode:
authorRandy Morgan <[email protected]>2012-11-05 14:08:42 +0900
committerRandy Morgan <[email protected]>2012-11-05 14:08:42 +0900
commit8ffd7652c4cc66b52f7992f24a2effc7dc3958c8 (patch)
tree07e8f9684d241db7fe513c2055ca2789df3361f2 /lib/axlsx/content_type
parent75eee58d7aecd0f0e89ec7a8ff2a37e6013f9e8d (diff)
downloadcaxlsx-8ffd7652c4cc66b52f7992f24a2effc7dc3958c8.tar.gz
caxlsx-8ffd7652c4cc66b52f7992f24a2effc7dc3958c8.zip
completed documentation
Diffstat (limited to 'lib/axlsx/content_type')
-rw-r--r--lib/axlsx/content_type/abstract_content_type.rb4
-rw-r--r--lib/axlsx/content_type/default.rb2
-rw-r--r--lib/axlsx/content_type/override.rb2
3 files changed, 8 insertions, 0 deletions
diff --git a/lib/axlsx/content_type/abstract_content_type.rb b/lib/axlsx/content_type/abstract_content_type.rb
index ac17dce9..0afaa53f 100644
--- a/lib/axlsx/content_type/abstract_content_type.rb
+++ b/lib/axlsx/content_type/abstract_content_type.rb
@@ -1,9 +1,12 @@
module Axlsx
+ # This class extracts the common parts from Default and Override
class AbstractContentType
include Axlsx::OptionsParser
+ # Initializes an abstract content type
+ # @see Default, Override
def initialize(options={})
parse_options options
end
@@ -18,6 +21,7 @@ module Axlsx
def content_type=(v) Axlsx::validate_content_type v; @content_type = v end
alias :ContentType= :content_type=
+ # Serialize the contenty type to xml
def to_xml_string(node_name = '', str = '')
str << "<#{node_name} "
str << instance_values.map { |key, value| '' << Axlsx::camel(key) << '="' << value.to_s << '"' }.join(' ')
diff --git a/lib/axlsx/content_type/default.rb b/lib/axlsx/content_type/default.rb
index 0cd00d48..3fe15609 100644
--- a/lib/axlsx/content_type/default.rb
+++ b/lib/axlsx/content_type/default.rb
@@ -4,6 +4,7 @@ module Axlsx
# An default content part. These parts are automatically created by for you based on the content of your package.
class Default < AbstractContentType
+ # The serialization node name for this class
NODE_NAME = 'Default'
# The extension of the content type.
@@ -15,6 +16,7 @@ module Axlsx
def extension=(v) Axlsx::validate_string v; @extension = v end
alias :Extension= :extension=
+ # Serializes this object to xml
def to_xml_string(str ='')
super(NODE_NAME, str)
end
diff --git a/lib/axlsx/content_type/override.rb b/lib/axlsx/content_type/override.rb
index 01918321..7a8e33fa 100644
--- a/lib/axlsx/content_type/override.rb
+++ b/lib/axlsx/content_type/override.rb
@@ -5,6 +5,7 @@ module Axlsx
# An override content part. These parts are automatically created by for you based on the content of your package.
class Override < AbstractContentType
+ # Serialization node name for this object
NODE_NAME = 'Override'
# The name and location of the part.
@@ -16,6 +17,7 @@ module Axlsx
def part_name=(v) Axlsx::validate_string v; @part_name = v end
alias :PartName= :part_name=
+ # Serializes this object to xml
def to_xml_string(str = '')
super(NODE_NAME, str)
end