Sha256: c2a182735e6dbc10d902176b861fde5768e7e5707cab2ca88e967079a0341d5b

Contents?: true

Size: 972 Bytes

Versions: 2

Compression:

Stored size: 972 Bytes

Contents

# frozen_string_literal: true

require_relative 'page_fields/page_field'

module OoxmlParser
  # Class for parsing <pageFields> tag
  class PageFields < OOXMLDocumentObject
    # @return [Integer] count
    attr_reader :count
    # @return [Array<PageField>] list of PageField object
    attr_reader :page_field

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

    # @return [PageField] accessor
    def [](key)
      @page_field[key]
    end

    # Parse `<pageFields>` tag
    # @param [Nokogiri::XML:Element] node with pageFields data
    # @return [PageFields]
    def parse(node)
      node.attributes.each do |key, value|
        case key
        when 'count'
          @count = value.value.to_i
        end
      end

      node.xpath('*').each do |node_child|
        case node_child.name
        when 'pageField'
          @page_field << PageField.new(parent: self).parse(node_child)
        end
      end
      self
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ooxml_parser-0.37.1 lib/ooxml_parser/xlsx_parser/workbook/pivot_table_definition/page_fields.rb
ooxml_parser-0.37.0 lib/ooxml_parser/xlsx_parser/workbook/pivot_table_definition/page_fields.rb