summaryrefslogtreecommitdiffhomepage
path: root/lib/axlsx/util/validators.rb
diff options
context:
space:
mode:
authorJan-Hendrik Hühne <[email protected]>2012-05-22 13:41:11 +0200
committerJan-Hendrik Hühne <[email protected]>2012-05-22 13:41:11 +0200
commit0df1bc655f5e6bfa0a6f89b7517a74a2cfaffc87 (patch)
tree98aa3032f10c786d6d2ef2a10f57c50911bff81f /lib/axlsx/util/validators.rb
parent745a47bf2a7f90e8538d011481979e3e57761787 (diff)
downloadcaxlsx-0df1bc655f5e6bfa0a6f89b7517a74a2cfaffc87.tar.gz
caxlsx-0df1bc655f5e6bfa0a6f89b7517a74a2cfaffc87.zip
First try of the data validation feature.
Diffstat (limited to 'lib/axlsx/util/validators.rb')
-rw-r--r--lib/axlsx/util/validators.rb21
1 files changed, 21 insertions, 0 deletions
diff --git a/lib/axlsx/util/validators.rb b/lib/axlsx/util/validators.rb
index 2f43a121..f1ba5ae7 100644
--- a/lib/axlsx/util/validators.rb
+++ b/lib/axlsx/util/validators.rb
@@ -217,4 +217,25 @@ module Axlsx
RestrictionValidator.validate :table_element_type, [:wholeTable, :headerRow, :totalRow, :firstColumn, :lastColumn, :firstRowStripe, :secondRowStripe, :firstColumnStripe, :secondColumnStripe, :firstHeaderCell, :lastHeaderCell, :firstTotalCell, :lastTotalCell, :firstSubtotalColumn, :secondSubtotalColumn, :thirdSubtotalColumn, :firstSubtotalRow, :secondSubtotalRow, :thirdSubtotalRow, :blankRow, :firstColumnSubheading, :secondColumnSubheading, :thirdColumnSubheading, :firstRowSubheading, :secondRowSubheading, :thirdRowSubheading, :pageFieldLabels, :pageFieldValues], v
end
+ # Requires that the value is a valid data_validation_error_style
+ # :information, :stop, :warning
+ # @param [Any] v The value validated
+ def self.validate_data_validation_error_style(v)
+ RestrictionValidator.validate :validate_data_validation_error_style, [:informatiom, :stop, :warning]
+ end
+
+ # Requires that the value is valid data validation operator.
+ # valid operators must be one of lessThan, lessThanOrEqual, equal,
+ # notEqual, greaterThanOrEqual, greaterThan, between, notBetween
+ # @param [Any] v The value validated
+ def self.validate_data_validation_operator(v)
+ RestrictionValidator.validate :data_validation_operator, [:lessThan, :lessThanOrEqual, :equal, :notEqual, :greaterThanOrEqual, :greaterThan, :between, :notBetween], v
+ end
+
+ # Requires that the value is valid data validation type.
+ # valid types must be one of custom, data, decimal, list, none, textLength, time, whole
+ # @param [Any] v The value validated
+ def self.validate_data_validation_type(v)
+ RestrictionValidator.validate :data_validation_type, [:custom, :data, :decimal, :list, :none, :textLength, :time, :whole], v
+ end
end