Sha256: 6dc6a6c5b7f5384184266b518220afa78d3629429961013e11f637f3bba1a968

Contents?: true

Size: 1.19 KB

Versions: 28

Compression:

Stored size: 1.19 KB

Contents

# frozen_string_literal: true

module OoxmlParser
  # Class for `cfvo` data
  class ConditionalFormatValueObject < OOXMLDocumentObject
    # @return [Symbol] Value type
    attr_reader :type
    # @return [String] Value
    attr_reader :value
    # @return [Symbol] Specifies whether value uses greater than or equal to operator
    attr_reader :greater_or_equal
    # @return [Formula] Formula
    attr_reader :formula

    def initialize(parent: nil)
      @greater_or_equal = true
      super
    end

    # Parse ConditionalFormatValueObject data
    # @param [Nokogiri::XML:Element] node with ConditionalFormatValueObject data
    # @return [ConditionalFormatValueObject] value of ConditionalFormatValueObject data
    def parse(node)
      node.attributes.each do |key, value|
        case key
        when 'type'
          @type = value.value.to_sym
        when 'val'
          @value = value.value.to_s
        when 'gte'
          @greater_or_equal = attribute_enabled?(value)
        end
      end

      node.xpath('*').each do |node_child|
        case node_child.name
        when 'f'
          @formula = Formula.new(parent: self).parse(node_child)
        end
      end
      self
    end
  end
end

Version data entries

28 entries across 28 versions & 1 rubygems

Version Path
ooxml_parser-0.21.0 lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/table_part/extension_list/extension/conditional_formattings/conditional_formatting/conditional_formatting_rule/data_bar/conditional_format_value_object.rb
ooxml_parser-0.20.0 lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/table_part/extension_list/extension/conditional_formattings/conditional_formatting/conditional_formatting_rule/data_bar/conditional_format_value_object.rb
ooxml_parser-0.19.0 lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/table_part/extension_list/extension/conditional_formattings/conditional_formatting/conditional_formatting_rule/data_bar/conditional_format_value_object.rb
ooxml_parser-0.18.1 lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/table_part/extension_list/extension/conditional_formattings/conditional_formatting/conditional_formatting_rule/data_bar/conditional_format_value_object.rb
ooxml_parser-0.18.0 lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/table_part/extension_list/extension/conditional_formattings/conditional_formatting/conditional_formatting_rule/data_bar/conditional_format_value_object.rb
ooxml_parser-0.17.0 lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/table_part/extension_list/extension/conditional_formattings/conditional_formatting/conditional_formatting_rule/data_bar/conditional_format_value_object.rb
ooxml_parser-0.16.0 lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/table_part/extension_list/extension/conditional_formattings/conditional_formatting/conditional_formatting_rule/data_bar/conditional_format_value_object.rb
ooxml_parser-0.15.0 lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/table_part/extension_list/extension/conditional_formattings/conditional_formatting/conditional_formatting_rule/data_bar/conditional_format_value_object.rb