class OoxmlParser::ColorScale

Class for ‘colorScale` data

Attributes

colors[R]

@return [Array<OoxmlColor>] list of colors

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/workbook/worksheet/table_part/extension_list/extension/conditional_formattings/conditional_formatting/conditional_formatting_rule/color_scale.rb, line 11
def initialize(parent: nil)
  @values = []
  @colors = []
  super
end

Public Instance Methods

parse(node) click to toggle source

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

# File lib/ooxml_parser/xlsx_parser/workbook/worksheet/table_part/extension_list/extension/conditional_formattings/conditional_formatting/conditional_formatting_rule/color_scale.rb, line 20
def parse(node)
  node.xpath('*').each do |node_child|
    case node_child.name
    when 'cfvo'
      @values << ConditionalFormatValueObject.new(parent: self).parse(node_child)
    when 'color'
      @colors << OoxmlColor.new(parent: self).parse(node_child)
    end
  end
  self
end