class OoxmlParser::RowFields

Class for parsing <rowFields> tag

Attributes

count[R]

@return [Integer] count

fields[R]

@return [Array<Field>] list of Field 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/row_fields.rb, line 13
def initialize(parent: nil)
  @fields = []
  super
end

Public Instance Methods

[](key) click to toggle source

@return [Field] accessor

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

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

# File lib/ooxml_parser/xlsx_parser/workbook/pivot_table_definition/row_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 'field'
      @fields << Field.new(parent: self).parse(node_child)
    end
  end
  self
end