Class: OoxmlParser::IconSet

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

Overview

Class for ‘iconSet` 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) ⇒ IconSet

Returns a new instance of IconSet.



20
21
22
23
24
25
# File 'lib/ooxml_parser/xlsx_parser/workbook/worksheet/table_part/extension_list/extension/conditional_formattings/conditional_formatting/conditional_formatting_rule/icon_set.rb', line 20

def initialize(parent: nil)
  @values = []
  @icons = []
  @show_value = true
  super
end

Instance Attribute Details

#customSymbol (readonly)

Returns Specifies whether icon set is custom.

Returns:

  • (Symbol)

    Specifies whether icon set is custom



14
15
16
# File 'lib/ooxml_parser/xlsx_parser/workbook/worksheet/table_part/extension_list/extension/conditional_formattings/conditional_formatting/conditional_formatting_rule/icon_set.rb', line 14

def custom
  @custom
end

#iconsArray<ConditionalFormattingIcon> (readonly)

Returns list of icons for custom sets.

Returns:



18
19
20
# File 'lib/ooxml_parser/xlsx_parser/workbook/worksheet/table_part/extension_list/extension/conditional_formattings/conditional_formatting/conditional_formatting_rule/icon_set.rb', line 18

def icons
  @icons
end

#reverseSymbol (readonly)

Returns Specifies whether icons are shown in reverse order.

Returns:

  • (Symbol)

    Specifies whether icons are shown in reverse order



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

def reverse
  @reverse
end

#setString (readonly)

Returns Name of icon set.

Returns:

  • (String)

    Name of icon set



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

def set
  @set
end

#show_valueSymbol (readonly)

Returns Specifies whether value is shown in a cell.

Returns:

  • (Symbol)

    Specifies whether value is shown in a cell



12
13
14
# File 'lib/ooxml_parser/xlsx_parser/workbook/worksheet/table_part/extension_list/extension/conditional_formattings/conditional_formatting/conditional_formatting_rule/icon_set.rb', line 12

def show_value
  @show_value
end

#valuesArray<ConditionalFormatValueObject> (readonly)

Returns list of values.

Returns:



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

def values
  @values
end

Instance Method Details

#parse(node) ⇒ IconSet

Parse IconSet data

Parameters:

  • node (Nokogiri::XML:Element)

    with IconSet data

Returns:

  • (IconSet)

    value of IconSet data



30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/ooxml_parser/xlsx_parser/workbook/worksheet/table_part/extension_list/extension/conditional_formattings/conditional_formatting/conditional_formatting_rule/icon_set.rb', line 30

def parse(node)
  node.attributes.each do |key, value|
    case key
    when 'iconSet'
      @set = value.value.to_s
    when 'reverse'
      @reverse = attribute_enabled?(value)
    when 'showValue'
      @show_value = attribute_enabled?(value)
    when 'custom'
      @custom = attribute_enabled?(value)
    end
  end

  node.xpath('*').each do |node_child|
    case node_child.name
    when 'cfvo'
      @values << ConditionalFormatValueObject.new(parent: self).parse(node_child)
    when 'cfIcon'
      @icons << ConditionalFormattingIcon.new(parent: self).parse(node_child)
    end
  end
  self
end