Class: OoxmlParser::CacheSource

Inherits:
OOXMLDocumentObject show all
Defined in:
lib/ooxml_parser/xlsx_parser/workbook/pivot_cache/pivot_cache_definition/cache_source.rb

Overview

Class for parsing <cacheSource> file

Instance Attribute Summary collapse

Attributes inherited from OOXMLDocumentObject

#parent

Instance Method Summary collapse

Methods inherited from OOXMLDocumentObject

#==, #boolean_attribute_value, #initialize, #parse_xml, #with_data?

Methods included from OoxmlObjectAttributeHelper

#attribute_enabled?, #option_enabled?

Methods included from OoxmlDocumentObjectHelper

#to_hash

Constructor Details

This class inherits a constructor from OoxmlParser::OOXMLDocumentObject

Instance Attribute Details

#typeString (readonly)

Returns type.

Returns:

  • (String)

    type



9
10
11
# File 'lib/ooxml_parser/xlsx_parser/workbook/pivot_cache/pivot_cache_definition/cache_source.rb', line 9

def type
  @type
end

#worksheet_sourceWorksheetSource (readonly)

Returns source of worksheet data.

Returns:



11
12
13
# File 'lib/ooxml_parser/xlsx_parser/workbook/pivot_cache/pivot_cache_definition/cache_source.rb', line 11

def worksheet_source
  @worksheet_source
end

Instance Method Details

#parse(node) ⇒ CacheSource

Parse ‘<cacheSource>` tag # @param [Nokogiri::XML:Element] node with CacheSource data

Returns:



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/ooxml_parser/xlsx_parser/workbook/pivot_cache/pivot_cache_definition/cache_source.rb', line 16

def parse(node)
  node.attributes.each do |key, value|
    case key
    when 'type'
      @type = value.value.to_s
    end
  end

  node.xpath('*').each do |node_child|
    case node_child.name
    when 'worksheetSource'
      @worksheet_source = WorksheetSource.new(parent: self).parse(node_child)
    end
  end
  self
end