Sha256: 877cd4fcd15613dfde47083dc9462f1e9abef737c4732ad40c3e8b8d43636f64

Contents?: true

Size: 1.96 KB

Versions: 17

Compression:

Stored size: 1.96 KB

Contents

module Axlsx
  # Conditional Format Value Object
  # Describes the values of the interpolation points in a gradient scale. This object is used by ColorScale, DataBar and IconSet classes
  #
  # @note The recommended way to manage these rules is via Worksheet#add_conditional_formatting
  # @see Worksheet#add_conditional_formatting
  # @see ConditionalFormattingRule#initialize
  #
  class Cfvo

    include Axlsx::OptionsParser
    include Axlsx::SerializedAttributes

    # Creates a new Cfvo object
    # @option options [Symbol] type The type of conditional formatting value object
    # @option options [Boolean]  gte threshold value usage indicator
    # @option options [String] val The value of the conditional formatting object
    def initialize(options={})
      @gte = true
      parse_options options
    end

    serializable_attributes :type, :gte, :val

    # Type (ST_CfvoType)
    # The type of this conditional formatting value object. options are num, percent, max, min, formula and percentile
    # @return [Symbol]
    attr_reader :type

    # Type (xsd:boolean)
    # For icon sets, determines whether this threshold value uses the greater than or equal to operator. 0 indicates 'greater than' is used instead of 'greater than or equal to'.
    # The default value is true
    # @return [Boolean]
    attr_reader :gte

    # Type (ST_Xstring)
    # The value of the conditional formatting object
    # This library will accept any value so long as it supports to_s
    attr_reader :val

    # @see type
    def type=(v); Axlsx::validate_conditional_formatting_value_object_type(v); @type = v end

    # @see gte
    def gte=(v); Axlsx::validate_boolean(v); @gte = v end

    # @see val
    def val=(v)
      raise ArgumentError, "#{v.inspect} must respond to to_s" unless v.respond_to?(:to_s)
      @val = v.to_s
    end

    # serialize the Csvo object
    # @param [String] str
    # @return [String]
    def to_xml_string(str = '')
      serialized_tag('cfvo', str)
    end
  end
end

Version data entries

17 entries across 17 versions & 6 rubygems

Version Path
caxlsx-3.3.0 lib/axlsx/workbook/worksheet/cfvo.rb
caxlsx-3.1.1 lib/axlsx/workbook/worksheet/cfvo.rb
caxlsx-3.1.0 lib/axlsx/workbook/worksheet/cfvo.rb
bonio-axlsx-2.2.3 lib/axlsx/workbook/worksheet/cfvo.rb
caxlsx-3.0.4 lib/axlsx/workbook/worksheet/cfvo.rb
caxlsx-3.0.3 lib/axlsx/workbook/worksheet/cfvo.rb
caxlsx-3.0.2 lib/axlsx/workbook/worksheet/cfvo.rb
caxlsx-3.0.1 lib/axlsx/workbook/worksheet/cfvo.rb
caxlsx-3.0.0 lib/axlsx/workbook/worksheet/cfvo.rb
axlsx-alt-3.0.1 lib/axlsx/workbook/worksheet/cfvo.rb
axlsx-alt-3.0.0 lib/axlsx/workbook/worksheet/cfvo.rb
axlsx-3.0.0.pre lib/axlsx/workbook/worksheet/cfvo.rb
bonio-axlsx-2.2.2 lib/axlsx/workbook/worksheet/cfvo.rb
bonio-axlsx-2.2.1 lib/axlsx/workbook/worksheet/cfvo.rb
dg-axlsx-2.1.0 lib/axlsx/workbook/worksheet/cfvo.rb
axlsx-2.1.0.pre lib/axlsx/workbook/worksheet/cfvo.rb
l_axlsx-2.0.1 lib/axlsx/workbook/worksheet/cfvo.rb