class OoxmlParser::ContentTypes
Class for data from ‘[Content_Types].xml` file
Attributes
@return [Array] list of content types
Public Class Methods
Source
# File lib/ooxml_parser/common_parser/common_data/content_types.rb, line 11 def initialize(parent: nil) @content_types_list = [] super end
Calls superclass method
Public Instance Methods
Source
# File lib/ooxml_parser/common_parser/common_data/content_types.rb, line 17 def [](key) @content_types_list[key] end
@return [Array] accessor
Source
# File lib/ooxml_parser/common_parser/common_data/content_types.rb, line 41 def by_type(type) @content_types_list.select { |item| item.content_type == type } end
Get content definition by type @param [String] type of definition @return [Object] resulting objects
Source
# File lib/ooxml_parser/common_parser/common_data/content_types.rb, line 23 def parse doc = parse_xml("#{root_object.unpacked_folder}/[Content_Types].xml") node = doc.xpath('*').first node.xpath('*').each do |node_child| case node_child.name when 'Default' @content_types_list << ContentTypeDefault.new(parent: self).parse(node_child) when 'Override' @content_types_list << ContentTypeOverride.new(parent: self).parse(node_child) end end self end
Parse ContentTypes
object @return [ContentTypes] result of parsing