Sha256: 318be8ea4da340a5496b36fc3afc776dfbb85f7dd3e784cfb5091c7a1b275b75

Contents?: true

Size: 826 Bytes

Versions: 8

Compression:

Stored size: 826 Bytes

Contents

# frozen_string_literal: true

require_relative 'tabs/tab'
module OoxmlParser
  # Class for working with `w:tabs`
  class Tabs < OOXMLDocumentObject
    # @return [Array, ParagraphTabs]
    attr_accessor :tabs_array

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

    # @return [Array, Column] accessor
    def [](key)
      @tabs_array[key]
    end

    # @return [True, False] if empty
    def empty?
      @tabs_array.empty?
    end

    # Parse Tabs data
    # @param [Nokogiri::XML:Element] node with Tabs data
    # @return [Tabs] value of Columns data
    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
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
ooxml_parser-0.8.1 lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_properties/tabs.rb
ooxml_parser-0.8.0 lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_properties/tabs.rb
ooxml_parser-0.7.2 lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_properties/tabs.rb
ooxml_parser-0.7.1 lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_properties/tabs.rb
ooxml_parser-0.7.0 lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_properties/tabs.rb
ooxml_parser-0.6.0 lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_properties/tabs.rb
ooxml_parser-0.5.1 lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_properties/tabs.rb
ooxml_parser-0.5.0 lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_properties/tabs.rb