Class: OoxmlParser::ConditionalFormattings

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

Overview

Class for ‘conditionalFormattings` 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) ⇒ ConditionalFormattings

Returns a new instance of ConditionalFormattings.



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

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

Instance Attribute Details

#conditional_formattings_listArray<ConditionalFormatting> (readonly)

Returns list of conditional formattings.

Returns:



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

def conditional_formattings_list
  @conditional_formattings_list
end

Instance Method Details

#[](key) ⇒ Array, ConditionalFormatting

Returns accessor.

Returns:



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

def [](key)
  @conditional_formattings_list[key]
end

#parse(node) ⇒ ConditionalFormattings

Parse ConditionalFormattings data

Parameters:

  • node (Nokogiri::XML:Element)

    with ConditionalFormattings data

Returns:



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

def parse(node)
  node.xpath('*').each do |node_child|
    case node_child.name
    when 'conditionalFormatting'
      @conditional_formattings_list << ConditionalFormatting.new(parent: self).parse(node_child)
    end
  end
  self
end