class OoxmlParser::CacheField

Class for parsing <cacheField> tag

Attributes

name[R]

@return [String] name of field

number_format_id[R]

@return [Integer] number format id

shared_items[R]

@return [SharedItems] shared items

Public Instance Methods

parse(node) click to toggle source

Parse `<cacheField>` tag # @param [Nokogiri::XML:Element] node with WorksheetSource data @return [CacheField]

# File lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/pivot_cache/pivot_cache_definition/cache_fields/cache_field.rb, line 18
def parse(node)
  node.attributes.each do |key, value|
    case key
    when 'name'
      @name = value.value.to_s
    when 'numFmtId'
      @number_format_id = value.value.to_i
    end
  end

  node.xpath('*').each do |node_child|
    case node_child.name
    when 'sharedItems'
      @shared_items = SharedItems.new(parent: self).parse(node_child)
    end
  end
  self
end