Class: OoxmlParser::OldDocxGroup

Inherits:
OOXMLDocumentObject show all
Defined in:
lib/ooxml_parser/common_parser/common_data/alternate_content/picture/group/old_docx_group.rb

Instance Attribute Summary collapse

Attributes inherited from OOXMLDocumentObject

#parent

Instance Method Summary collapse

Methods inherited from OOXMLDocumentObject

#==, add_to_xmls_stack, copy_file_and_rename_to_zip, current_xml, dir, encrypted_file?, get_link_from_rels, unzip_file, #with_data?

Methods included from OoxmlDocumentObjectHelper

#to_hash

Constructor Details

#initialize(properties = OldDocxGroupProperties.new, parent: nil) ⇒ OldDocxGroup

Returns a new instance of OldDocxGroup.



8
9
10
11
12
# File 'lib/ooxml_parser/common_parser/common_data/alternate_content/picture/group/old_docx_group.rb', line 8

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

Instance Attribute Details

#elementsObject

Returns the value of attribute elements.



6
7
8
# File 'lib/ooxml_parser/common_parser/common_data/alternate_content/picture/group/old_docx_group.rb', line 6

def elements
  @elements
end

#propertiesObject

Returns the value of attribute properties.



6
7
8
# File 'lib/ooxml_parser/common_parser/common_data/alternate_content/picture/group/old_docx_group.rb', line 6

def properties
  @properties
end

Instance Method Details

#parse(node) ⇒ OldDocxGroup

Parse OldDocxGroup object

Parameters:

  • node (Nokogiri::XML:Element)

    node to parse

Returns:



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/ooxml_parser/common_parser/common_data/alternate_content/picture/group/old_docx_group.rb', line 17

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