blob: 719858966c2d014579647d7fc8b37f6853a09357 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
|
# frozen_string_literal: true
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
|