class OoxmlParser::PivotCache

Class for parsing <pivotCache> tag

Attributes

cache_id[R]

@return [Integer] cacheId of pivot cache

id[R]

@return [String] id of pivot cache

pivot_cache_definition[R]

@return [PivotCacheDefinition] parsed pivot cache definition

Public Instance Methods

parse(node) click to toggle source

Parse Pivot Cache data @param [Nokogiri::XML:Element] node with Pivot Cache data @return [PivotCache] value of PivotCache

# File lib/ooxml_parser/xlsx_parser/workbook/pivot_cache.rb, line 18
def parse(node)
  node.attributes.each do |key, value|
    case key
    when 'cacheId'
      @cache_id = value.value.to_i
    when 'id'
      @id = value.value.to_s
    end
  end
  parse_pivot_cache_definition
  self
end

Private Instance Methods

parse_pivot_cache_definition() click to toggle source

@return [PivotCacheDefinition] pivot cache definition for current pivot cache

# File lib/ooxml_parser/xlsx_parser/workbook/pivot_cache.rb, line 34
def parse_pivot_cache_definition
  definition_file = root_object.relationships.target_by_id(id)
  full_file_path = "#{root_object.unpacked_folder}/xl/#{definition_file}"
  @pivot_cache_definition = PivotCacheDefinition.new(parent: root_object)
                                                .parse(full_file_path)
end