Class: OoxmlParser::PivotField
- Inherits:
-
OOXMLDocumentObject
- Object
- OOXMLDocumentObject
- OoxmlParser::PivotField
- Defined in:
- lib/ooxml_parser/xlsx_parser/workbook/pivot_table_definition/pivot_fields/pivot_field.rb
Overview
Class for parsing <pivotField> tag
Instance Attribute Summary collapse
-
#axis ⇒ String
readonly
Axis value.
-
#items ⇒ Items
readonly
Contain item.
-
#name ⇒ String
readonly
Field name.
-
#show_all ⇒ True, False
readonly
Should show all.
Attributes inherited from OOXMLDocumentObject
Instance Method Summary collapse
-
#parse(node) ⇒ PivotField
Parse ‘<pivotField>` tag # @param [Nokogiri::XML:Element] node with PivotField data.
Methods inherited from OOXMLDocumentObject
#==, #boolean_attribute_value, #initialize, #parse_xml, #with_data?
Methods included from OoxmlObjectAttributeHelper
#attribute_enabled?, #option_enabled?
Methods included from OoxmlDocumentObjectHelper
Constructor Details
This class inherits a constructor from OoxmlParser::OOXMLDocumentObject
Instance Attribute Details
#axis ⇒ String (readonly)
Returns axis value.
11 12 13 |
# File 'lib/ooxml_parser/xlsx_parser/workbook/pivot_table_definition/pivot_fields/pivot_field.rb', line 11 def axis @axis end |
#items ⇒ Items (readonly)
Returns contain item.
15 16 17 |
# File 'lib/ooxml_parser/xlsx_parser/workbook/pivot_table_definition/pivot_fields/pivot_field.rb', line 15 def items @items end |
#name ⇒ String (readonly)
Returns field name.
9 10 11 |
# File 'lib/ooxml_parser/xlsx_parser/workbook/pivot_table_definition/pivot_fields/pivot_field.rb', line 9 def name @name end |
#show_all ⇒ True, False (readonly)
Returns should show all.
13 14 15 |
# File 'lib/ooxml_parser/xlsx_parser/workbook/pivot_table_definition/pivot_fields/pivot_field.rb', line 13 def show_all @show_all end |
Instance Method Details
#parse(node) ⇒ PivotField
Parse ‘<pivotField>` tag # @param [Nokogiri::XML:Element] node with PivotField data
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/ooxml_parser/xlsx_parser/workbook/pivot_table_definition/pivot_fields/pivot_field.rb', line 20 def parse(node) node.attributes.each do |key, value| case key when 'name' @name = value.value.to_s when 'axis' @axis = value.value.to_s when 'showAll' @show_all = attribute_enabled?(value) end end node.xpath('*').each do |node_child| case node_child.name when 'items' @items = Items.new(parent: self).parse(node_child) end end self end |