Class: OoxmlParser::Tabs

Inherits:
OOXMLDocumentObject show all
Defined in:
lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_properties/tabs.rb

Overview

Class for working with ‘w:tabs`

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) ⇒ Tabs

Returns a new instance of Tabs.



10
11
12
13
# File 'lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_properties/tabs.rb', line 10

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

Instance Attribute Details

#tabs_arrayArray, ParagraphTabs

Returns:

  • (Array, ParagraphTabs)


8
9
10
# File 'lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_properties/tabs.rb', line 8

def tabs_array
  @tabs_array
end

Instance Method Details

#[](key) ⇒ Array, Column

Returns accessor.

Returns:

  • (Array, Column)

    accessor



16
17
18
# File 'lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_properties/tabs.rb', line 16

def [](key)
  @tabs_array[key]
end

#empty?True, False

Returns if empty.

Returns:

  • (True, False)

    if empty



21
22
23
# File 'lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_properties/tabs.rb', line 21

def empty?
  @tabs_array.empty?
end

#parse(node) ⇒ Tabs

Parse Tabs data

Parameters:

  • node (Nokogiri::XML:Element)

    with Tabs data

Returns:

  • (Tabs)

    value of Columns data



28
29
30
31
32
33
34
35
36
# File 'lib/ooxml_parser/common_parser/common_data/paragraph/paragraph_properties/tabs.rb', line 28

def parse(node)
  node.xpath('*').each do |node_child|
    case node_child.name
    when 'tab'
      @tabs_array << Tab.new(parent: self).parse(node_child)
    end
  end
  self
end