class OoxmlParser::IconSet

Class for `iconSet` data

Attributes

custom[R]

@return [Symbol] Specifies whether icon set is custom

icons[R]

@return [Array<ConditionalFormattingIcon>] list of icons for custom sets

reverse[R]

@return [Symbol] Specifies whether icons are shown in reverse order

set[R]

@return [String] Name of icon set

show_value[R]

@return [Symbol] Specifies whether value is shown in a cell

values[R]

@return [Array<ConditionalFormatValueObject>] list of values

Public Class Methods

new(parent: nil) click to toggle source
Calls superclass method OoxmlParser::OOXMLDocumentObject::new
# File lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/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

Public Instance Methods

parse(node) click to toggle source

Parse IconSet data @param [Nokogiri::XML:Element] node with IconSet data @return [IconSet] value of IconSet data

# File lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/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