Sha256: 0100a7c7dfe734002599a754ad280ec73661d419b0b8cbfb30eb2540d4099431

Contents?: true

Size: 1.03 KB

Versions: 4

Compression:

Stored size: 1.03 KB

Contents

require_relative 'old_docx_group_properties'
require_relative 'old_docx_group_element'
# Fallback DOCX group data
module OoxmlParser
  class OldDocxGroup < OOXMLDocumentObject
    attr_accessor :elements, :properties

    def initialize(properties = OldDocxGroupProperties.new, parent: nil)
      @properties = properties
      @elements = []
      @parent = parent
    end

    # Parse OldDocxGroup object
    # @param node [Nokogiri::XML:Element] node to parse
    # @return [OldDocxGroup] result of parsing
    def parse(node)
      node.xpath('*').each do |node_child|
        case node_child.name
        when 'shape'
          element = OldDocxGroupElement.new(:shape)
          element.object = OldDocxShape.new(parent: self).parse(node_child)
          @elements << element
        when 'wrap'
          @properties.wrap = node_child.attribute('type').value.to_sym unless node_child.attribute('type').nil?
        when 'group'
          @elements << OldDocxGroup.new(parent: self).parse(node_child)
        end
      end
      self
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
ooxml_parser-0.4.1 lib/ooxml_parser/common_parser/common_data/alternate_content/picture/group/old_docx_group.rb
ooxml_parser-0.4.0 lib/ooxml_parser/common_parser/common_data/alternate_content/picture/group/old_docx_group.rb
ooxml_parser-0.3.0 lib/ooxml_parser/common_parser/common_data/alternate_content/picture/group/old_docx_group.rb
ooxml_parser-0.2.0 lib/ooxml_parser/common_parser/common_data/alternate_content/picture/group/old_docx_group.rb