Sha256: af4b5bff27e6eac3442af186ad5461745aa17a508964d31c81685edfbffff213

Contents?: true

Size: 968 Bytes

Versions: 8

Compression:

Stored size: 968 Bytes

Contents

# frozen_string_literal: true

require_relative 'pivot_cache_definition/cache_source'
module OoxmlParser
  # Class for parsing <pivotCacheDefinition> file
  class PivotCacheDefinition < OOXMLDocumentObject
    # @return [String] id of pivot cache definition
    attr_reader :id
    # @return [CacheSource] source of pivot cache
    attr_reader :cache_source

    # Parse PivotCacheDefinition file
    # @param file [String] path to file
    # @return [PivotCacheDefinition]
    def parse(file)
      return nil unless File.exist?(file)

      document = parse_xml(file)
      node = document.xpath('*').first

      node.attributes.each do |key, value|
        case key
        when 'id'
          @id = value.value.to_s
        end
      end

      node.xpath('*').each do |node_child|
        case node_child.name
        when 'cacheSource'
          @cache_source = CacheSource.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.10.0 lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/pivot_cache/pivot_cache_definition.rb
ooxml_parser-0.9.1 lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/pivot_cache/pivot_cache_definition.rb
ooxml_parser-0.9.0 lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/pivot_cache/pivot_cache_definition.rb
ooxml_parser-0.8.1 lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/pivot_cache/pivot_cache_definition.rb
ooxml_parser-0.8.0 lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/pivot_cache/pivot_cache_definition.rb
ooxml_parser-0.7.2 lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/pivot_cache/pivot_cache_definition.rb
ooxml_parser-0.7.1 lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/pivot_cache/pivot_cache_definition.rb
ooxml_parser-0.7.0 lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/pivot_cache/pivot_cache_definition.rb