Class: OoxmlParser::AbstractNumbering

Inherits:
OOXMLDocumentObject show all
Defined in:
lib/ooxml_parser/docx_parser/document_structure/numbering/abstract_numbering.rb

Overview

This element specifies a set of properties which shall dictate the appearance and behavior of a set of numbered paragraphs in a WordprocessingML document.

Instance Attribute Summary collapse

Attributes inherited from OOXMLDocumentObject

#parent

Instance Method Summary collapse

Methods inherited from OOXMLDocumentObject

#==, #boolean_attribute_value, #parse_xml, #with_data?

Methods included from OoxmlObjectAttributeHelper

#attribute_enabled?, #option_enabled?

Methods included from OoxmlDocumentObjectHelper

#to_hash

Constructor Details

#initialize(parent: nil) ⇒ AbstractNumbering

Returns a new instance of AbstractNumbering.



17
18
19
20
# File 'lib/ooxml_parser/docx_parser/document_structure/numbering/abstract_numbering.rb', line 17

def initialize(parent: nil)
  @level_list = []
  super
end

Instance Attribute Details

#idInteger

Returns abstruct numbering id.

Returns:

  • (Integer)

    abstruct numbering id



11
12
13
# File 'lib/ooxml_parser/docx_parser/document_structure/numbering/abstract_numbering.rb', line 11

def id
  @id
end

#level_listArray, NumberingLevel

Returns numbering level data list.

Returns:



15
16
17
# File 'lib/ooxml_parser/docx_parser/document_structure/numbering/abstract_numbering.rb', line 15

def level_list
  @level_list
end

#multilevel_typeMultilevelType

Returns myltylevel type.

Returns:



13
14
15
# File 'lib/ooxml_parser/docx_parser/document_structure/numbering/abstract_numbering.rb', line 13

def multilevel_type
  @multilevel_type
end

Instance Method Details

#parse(node) ⇒ AbstractNumbering

Parse Abstract Numbering data

Parameters:

  • node (Nokogiri::XML:Element)

    with Abstract Numbering data

Returns:



25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/ooxml_parser/docx_parser/document_structure/numbering/abstract_numbering.rb', line 25

def parse(node)
  node.attributes.each do |key, value|
    case key
    when 'abstractNumId'
      @id = value.value.to_f
    end
  end

  node.xpath('*').each do |numbering_child_node|
    case numbering_child_node.name
    when 'multiLevelType'
      @multilevel_type = MultilevelType.new(parent: self).parse(numbering_child_node)
    when 'lvl'
      @level_list << NumberingLevel.new(parent: self).parse(numbering_child_node)
    end
  end
  self
end