Class: OoxmlParser::Tabs

Inherits:
OOXMLDocumentObject show all
Defined in:
lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_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

#==, 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(parent: nil) ⇒ Tabs

Returns a new instance of Tabs.



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

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

Instance Attribute Details

#tabs_arrayArray, ParagraphTabs

Returns:

  • (Array, ParagraphTabs)


6
7
8
# File 'lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_properties/tabs.rb', line 6

def tabs_array
  @tabs_array
end

Instance Method Details

#[](key) ⇒ Array, Column

Returns accessor.

Returns:

  • (Array, Column)

    accessor



14
15
16
# File 'lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_properties/tabs.rb', line 14

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

#empty?True, False

Returns if empty.

Returns:

  • (True, False)

    if empty



19
20
21
# File 'lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_properties/tabs.rb', line 19

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



26
27
28
29
30
31
32
33
34
# File 'lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_properties/tabs.rb', line 26

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