class OoxmlParser::Items

Class for parsing <items> tag

Attributes

count[R]

@return [Integer] count

items[R]

@return [Array<Item>] list of items

Public Class Methods

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

Public Instance Methods

[](key) click to toggle source

@return [Item] accessor

# File lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/pivot_table_definition/pivot_fields/pivot_field/items.rb, line 19
def [](key)
  @items[key]
end
parse(node) click to toggle source

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

# File lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/pivot_table_definition/pivot_fields/pivot_field/items.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 'item'
      @items << Item.new(parent: self).parse(node_child)
    end
  end
  self
end