class OoxmlParser::DataFields

Class for parsing <dataFields> tag

Attributes

count[R]

@return [Integer] count

data_field[R]

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

Public Class Methods

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

Public Instance Methods

[](key) click to toggle source

@return [DataField] accessor

# File lib/ooxml_parser/xlsx_parser/workbook/pivot_table_definition/data_fields.rb, line 19
def [](key)
  @data_field[key]
end
parse(node) click to toggle source

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

# File lib/ooxml_parser/xlsx_parser/workbook/pivot_table_definition/data_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 'dataField'
      @data_field << DataField.new(parent: self).parse(node_child)
    end
  end
  self
end