summaryrefslogtreecommitdiffhomepage
path: root/lib/axlsx/util/validators.rb
diff options
context:
space:
mode:
authorRandy Morgan <[email protected]>2012-02-13 22:28:58 +0900
committerRandy Morgan <[email protected]>2012-02-13 22:28:58 +0900
commit80459ca70930ee8522b8547669bbbe7aef5a12a4 (patch)
treedc5495352ba3e3b5dbb2c977e32c55f371397ab3 /lib/axlsx/util/validators.rb
parenta78481741fa7b6bf999461a12cc5c9dce026ea49 (diff)
downloadcaxlsx-80459ca70930ee8522b8547669bbbe7aef5a12a4.tar.gz
caxlsx-80459ca70930ee8522b8547669bbbe7aef5a12a4.zip
Improve accessibility and stringency for column_widths editing.
Diffstat (limited to 'lib/axlsx/util/validators.rb')
-rw-r--r--lib/axlsx/util/validators.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/axlsx/util/validators.rb b/lib/axlsx/util/validators.rb
index 9accd3db..ce810e54 100644
--- a/lib/axlsx/util/validators.rb
+++ b/lib/axlsx/util/validators.rb
@@ -53,6 +53,14 @@ module Axlsx
DataTypeValidator.validate(:unsigned_int, [Fixnum, Integer], v, lambda { |arg| arg.respond_to?(:>=) && arg >= 0 })
end
+ # Requires that the value is a Fixnum Integer or Float and is greater or equal to 0
+ # @param [Any] v The value validated
+ # @raise [ArgumentError] raised if the value is not a Fixnum or Integer value greater or equal to 0
+ # @return [Boolean] true if the data is valid
+ def self.validate_unsigned_numeric(v)
+ DataTypeValidator.validate("Invalid column width", [Fixnum, Integer, Float], v, lambda { |arg| arg.respond_to?(:>=) && arg >= 0 })
+ end
+
# Requires that the value is a Fixnum or Integer
# @param [Any] v The value validated
def self.validate_int(v)