Class: OoxmlParser::NumberingDefinition

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

Overview

This element specifies a unique instance of numbering information that can be referenced by zero or more paragraphs within the parent WordprocessingML document.

Instance Attribute Summary collapse

Attributes inherited from OOXMLDocumentObject

#parent

Instance Method Summary collapse

Methods inherited from OOXMLDocumentObject

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

Methods included from OoxmlObjectAttributeHelper

#attribute_enabled?, #option_enabled?

Methods included from OoxmlDocumentObjectHelper

#to_hash

Constructor Details

This class inherits a constructor from OoxmlParser::OOXMLDocumentObject

Instance Attribute Details

#abstract_numbering_idValuedChild

Returns abstract numbering id.

Returns:



10
11
12
# File 'lib/ooxml_parser/docx_parser/document_structure/numbering/numbering_definition.rb', line 10

def abstract_numbering_id
  @abstract_numbering_id
end

#idInteger

Returns num id.

Returns:

  • (Integer)

    num id



8
9
10
# File 'lib/ooxml_parser/docx_parser/document_structure/numbering/numbering_definition.rb', line 8

def id
  @id
end

Instance Method Details

#parse(node) ⇒ NumberingDefinition

Parse NumberingDefinition data

Parameters:

  • node (Nokogiri::XML:Element)

    with NumberingDefinition data

Returns:



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/ooxml_parser/docx_parser/document_structure/numbering/numbering_definition.rb', line 15

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

  node.xpath('*').each do |numbering_child_node|
    case numbering_child_node.name
    when 'abstractNumId'
      @abstract_numbering_id = ValuedChild.new(:integer, parent: self).parse(numbering_child_node)
    end
  end
  self
end