class OoxmlParser::CacheFields

Class for parsing <cacheFields> tag

Attributes

cache_field[R]

@return [Array<CacheField>] list of CacheField object

count[R]

@return [Integer] count

Public Class Methods

new(parent: nil) click to toggle source
Calls superclass method OoxmlParser::OOXMLDocumentObject::new
# File lib/ooxml_parser/xlsx_parser/workbook/pivot_cache/pivot_cache_definition/cache_fields.rb, line 13
def initialize(parent: nil)
  @cache_field = []
  super
end

Public Instance Methods

[](key) click to toggle source

@return [CacheField] accessor

# File lib/ooxml_parser/xlsx_parser/workbook/pivot_cache/pivot_cache_definition/cache_fields.rb, line 19
def [](key)
  @cache_field[key]
end
parse(node) click to toggle source

Parse ‘<cacheFields>` tag @param [Nokogiri::XML:Element] node with cacheFields data @return [cacheFields]

# File lib/ooxml_parser/xlsx_parser/workbook/pivot_cache/pivot_cache_definition/cache_fields.rb, line 26
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 'cacheField'
      @cache_field << CacheField.new(parent: self).parse(node_child)
    end
  end
  self
end