Class: Axlsx::Cfvo

Inherits:
Object
  • Object
show all
Defined in:
lib/axlsx/workbook/worksheet/cfvo.rb

Overview

Note:

The recommended way to manage these rules is via Worksheet#add_conditional_formatting

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Cfvo

Creates a new Cfvo object

Parameters:

  • options (Hash) (defaults to: {})

    a customizable set of options

Options Hash (options):

  • type (Symbol)

    The type of conditional formatting value object

  • gte (Boolean)

    threshold value usage indicator

  • val (String)

    The value of the conditional formatting object



33
34
35
36
37
38
# File 'lib/axlsx/workbook/worksheet/cfvo.rb', line 33

def initialize(options={})
  @gte = true
  options.each do |o|
    self.send("#{o[0]}=", o[1]) if self.respond_to? "#{o[0]}="
  end
end

Instance Attribute Details

#gteBoolean

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

Returns:

  • (Boolean)


21
22
23
# File 'lib/axlsx/workbook/worksheet/cfvo.rb', line 21

def gte
  @gte
end

#typeSymbol

Type (ST_CfvoType) The type of this conditional formatting value object. options are num, percent, max, min, formula and percentile

Returns:

  • (Symbol)


14
15
16
# File 'lib/axlsx/workbook/worksheet/cfvo.rb', line 14

def type
  @type
end

#valObject

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



27
28
29
# File 'lib/axlsx/workbook/worksheet/cfvo.rb', line 27

def val
  @val
end

Instance Method Details

#to_xml_string(str = '') ⇒ String

serialize the Csvo object

Parameters:

  • str (String) (defaults to: '')

Returns:

  • (String)


55
56
57
58
59
# File 'lib/axlsx/workbook/worksheet/cfvo.rb', line 55

def to_xml_string(str = '')
  str << '<cfvo '
  str << instance_values.map { |key, value| '' << key << '="' << value.to_s << '"' }.join(' ')
  str << ' />'
end