diff options
| author | Randy Morgan <[email protected]> | 2012-04-20 16:54:31 -0700 |
|---|---|---|
| committer | Randy Morgan <[email protected]> | 2012-04-20 16:54:31 -0700 |
| commit | e43fd6cb182205ee52dc76d19758b9f0203bab4e (patch) | |
| tree | d84e4b9e27ae722c6438e40024a69d5462c4c100 /lib/axlsx/util/validators.rb | |
| parent | fc8c56f9e1455332f6c3f10775cd11a0910b3476 (diff) | |
| parent | 83f633051eb24440424fe8700bbc49caa74c0589 (diff) | |
| download | caxlsx-e43fd6cb182205ee52dc76d19758b9f0203bab4e.tar.gz caxlsx-e43fd6cb182205ee52dc76d19758b9f0203bab4e.zip | |
Merge pull request #83 from scpike/master
Support for some of the conditional formatting spec
Diffstat (limited to 'lib/axlsx/util/validators.rb')
| -rw-r--r-- | lib/axlsx/util/validators.rb | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/lib/axlsx/util/validators.rb b/lib/axlsx/util/validators.rb index 54a0aeb4..14d34d36 100644 --- a/lib/axlsx/util/validators.rb +++ b/lib/axlsx/util/validators.rb @@ -96,6 +96,35 @@ module Axlsx :darkTrellis, :lightHorizontal, :lightVertical, :lightDown, :lightUp, :lightGrid, :lightTrellis, :gray125, :gray0625], v end + # Requires that the value is one of the ST_TimePeriod types + # valid time period types are today, yesterday, tomorrow, last7Days, + # thisMonth, lastMonth, nextMonth, thisWeek, lastWeek, nextWeek + def self.validate_time_period_type(v) + RestrictionValidator.validate :time_period_type, [:today, :yesterday, :tomorrow, :last7Days, :thisMonth, :lastMonth, :nextMonth, :thisWeek, :lastWeek, :nextWeek], v + + + end + + # Requires that the value is valid conditional formatting type. + # valid types must be one of expression, cellIs, colorScale, + # dataBar, iconSet, top10, uniqueValues, duplicateValues, + # containsText, notContainsText, beginsWith, endsWith, + # containsBlanks, notContainsBlanks, containsErrors, + # notContainsErrors, timePeriod, aboveAverage + # @param [Any] v The value validated + def self.validate_conditional_formatting_type(v) + RestrictionValidator.validate :conditional_formatting_type, [:expression, :cellIs, :colorScale, :dataBar, :iconSet, :top10, :uniqueValues, :duplicateValues, :containsText, :notContainsText, :beginsWith, :endsWith, :containsBlanks, :notContainsBlanks, :containsErrors, :notContainsErrors, :timePeriod, :aboveAverage], v + end + + # Requires that the value is valid conditional formatting operator. + # valid operators must be one of lessThan, lessThanOrEqual, equal, + # notEqual, greaterThanOrEqual, greaterThan, between, notBetween, + # containsText, notContains, beginsWith, endsWith + # @param [Any] v The value validated + def self.validate_conditional_formatting_operator(v) + RestrictionValidator.validate :conditional_formatting_type, [:lessThan, :lessThanOrEqual, :equal, :notEqual, :greaterThanOrEqual, :greaterThan, :between, :notBetween, :containsText, :notContains, :beginsWith, :endsWith], v + end + # Requires that the value is a gradient_type. # valid types are :linear and :path # @param [Any] v The value validated |
