Class: OoxmlParser::Sparklines

Inherits:
OOXMLDocumentObject show all
Defined in:
lib/ooxml_parser/xlsx_parser/workbook/worksheet/table_part/extension_list/extension/sparkline_groups/sparkline_group/sparklines.rb

Overview

Class for ‘sparklines` data

Instance Attribute Summary collapse

Attributes inherited from OOXMLDocumentObject

#parent

Instance Method Summary collapse

Methods inherited from OOXMLDocumentObject

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

Methods included from OoxmlObjectAttributeHelper

#attribute_enabled?, #option_enabled?

Methods included from OoxmlDocumentObjectHelper

#to_hash

Constructor Details

#initialize(parent: nil) ⇒ Sparklines

Returns a new instance of Sparklines.



10
11
12
13
# File 'lib/ooxml_parser/xlsx_parser/workbook/worksheet/table_part/extension_list/extension/sparkline_groups/sparkline_group/sparklines.rb', line 10

def initialize(parent: nil)
  @sparklines = []
  super
end

Instance Attribute Details

#sparklinesArray<Sparkline> (readonly)

Returns list of sparklines.

Returns:



8
9
10
# File 'lib/ooxml_parser/xlsx_parser/workbook/worksheet/table_part/extension_list/extension/sparkline_groups/sparkline_group/sparklines.rb', line 8

def sparklines
  @sparklines
end

Instance Method Details

#[](key) ⇒ Sparkline

Returns accessor.

Returns:



16
17
18
# File 'lib/ooxml_parser/xlsx_parser/workbook/worksheet/table_part/extension_list/extension/sparkline_groups/sparkline_group/sparklines.rb', line 16

def [](key)
  sparklines[key]
end

#parse(node) ⇒ Sparklines

Parse Sparklines data

Parameters:

  • node (Nokogiri::XML:Element)

    with Sparklines data

Returns:



23
24
25
26
27
28
29
30
31
# File 'lib/ooxml_parser/xlsx_parser/workbook/worksheet/table_part/extension_list/extension/sparkline_groups/sparkline_group/sparklines.rb', line 23

def parse(node)
  node.xpath('*').each do |column_node|
    case column_node.name
    when 'sparkline'
      @sparklines << Sparkline.new(parent: self).parse(column_node)
    end
  end
  self
end