Class: OoxmlParser::ColumnRowItems
- Inherits:
-
OOXMLDocumentObject
- Object
- OOXMLDocumentObject
- OoxmlParser::ColumnRowItems
- Defined in:
- lib/ooxml_parser/xlsx_parser/workbook/pivot_table_definition/column_row_items.rb
Overview
Class for parsing <rowItems> and <colItems> tag
Instance Attribute Summary collapse
-
#count ⇒ Integer
readonly
Count of items.
-
#items ⇒ Array<RowColumnItem>
readonly
List of RowColumnItem object.
Attributes inherited from OOXMLDocumentObject
Instance Method Summary collapse
-
#[](key) ⇒ RowColumnItem
Accessor.
-
#initialize(parent: nil) ⇒ ColumnRowItems
constructor
A new instance of ColumnRowItems.
-
#parse(node) ⇒ CacheField
Parse ‘<cacheField>` tag # @param [Nokogiri::XML:Element] node with WorksheetSource data.
Methods inherited from OOXMLDocumentObject
#==, #boolean_attribute_value, #parse_xml, #with_data?
Methods included from OoxmlObjectAttributeHelper
#attribute_enabled?, #option_enabled?
Methods included from OoxmlDocumentObjectHelper
Constructor Details
#initialize(parent: nil) ⇒ ColumnRowItems
Returns a new instance of ColumnRowItems.
13 14 15 16 |
# File 'lib/ooxml_parser/xlsx_parser/workbook/pivot_table_definition/column_row_items.rb', line 13 def initialize(parent: nil) @items = [] super end |
Instance Attribute Details
#count ⇒ Integer (readonly)
Returns count of items.
9 10 11 |
# File 'lib/ooxml_parser/xlsx_parser/workbook/pivot_table_definition/column_row_items.rb', line 9 def count @count end |
#items ⇒ Array<RowColumnItem> (readonly)
Returns list of RowColumnItem object.
11 12 13 |
# File 'lib/ooxml_parser/xlsx_parser/workbook/pivot_table_definition/column_row_items.rb', line 11 def items @items end |
Instance Method Details
#[](key) ⇒ RowColumnItem
Returns accessor.
19 20 21 |
# File 'lib/ooxml_parser/xlsx_parser/workbook/pivot_table_definition/column_row_items.rb', line 19 def [](key) @items[key] end |
#parse(node) ⇒ CacheField
Parse ‘<cacheField>` tag # @param [Nokogiri::XML:Element] node with WorksheetSource data
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/ooxml_parser/xlsx_parser/workbook/pivot_table_definition/column_row_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 'i' @items << ColumnRowItem.new(parent: self).parse(node_child) end end self end |