diff options
| author | Randy Morgan <[email protected]> | 2012-10-14 11:03:20 +0900 |
|---|---|---|
| committer | Randy Morgan <[email protected]> | 2012-10-14 11:03:20 +0900 |
| commit | 1c0563cf9e39b8fe3df011d6a24f61345b139e59 (patch) | |
| tree | d21bba92c4e02852788fb8428718661415ace908 /lib | |
| parent | 393c2b8ac4b221d416581c02359ceb09f16ae8f3 (diff) | |
| download | caxlsx-1c0563cf9e39b8fe3df011d6a24f61345b139e59.tar.gz caxlsx-1c0563cf9e39b8fe3df011d6a24f61345b139e59.zip | |
refactored Cfvo to use options parser and serialized attributes
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/axlsx/workbook/worksheet/cfvo.rb | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/lib/axlsx/workbook/worksheet/cfvo.rb b/lib/axlsx/workbook/worksheet/cfvo.rb index 22cf95d9..0577ba70 100644 --- a/lib/axlsx/workbook/worksheet/cfvo.rb +++ b/lib/axlsx/workbook/worksheet/cfvo.rb @@ -8,35 +8,36 @@ module Axlsx # class Cfvo + include Axlsx::OptionsParser + include Axlsx::SerailizedAttriubtes + + # 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 - # 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 - options.each do |o| - self.send("#{o[0]}=", o[1]) if self.respond_to? "#{o[0]}=" - end - end - # @see type def type=(v); Axlsx::validate_conditional_formatting_value_object_type(v); @type = v end @@ -54,9 +55,8 @@ module Axlsx # @return [String] def to_xml_string(str = '') str << '<cfvo ' - str << instance_values.map { |key, value| '' << key << '="' << value.to_s << '"' }.join(' ') + serialized_attributes str str << ' />' end - end end |
