summaryrefslogtreecommitdiffhomepage
path: root/lib/axlsx/util/validators.rb
diff options
context:
space:
mode:
authorrandym <[email protected]>2017-04-01 18:45:54 +0900
committerrandym <[email protected]>2017-04-01 18:45:54 +0900
commit83e23982914e87bb4f2feb00c508580b8fa85cdb (patch)
tree26f13718f0a2494a65c73a2c3d95146cc50b5bf4 /lib/axlsx/util/validators.rb
parentb4bdbfa6a3da344a7bd5a1d433be6488435b94f8 (diff)
downloadcaxlsx-83e23982914e87bb4f2feb00c508580b8fa85cdb.tar.gz
caxlsx-83e23982914e87bb4f2feb00c508580b8fa85cdb.zip
chore(doc): document some members
Diffstat (limited to 'lib/axlsx/util/validators.rb')
-rw-r--r--lib/axlsx/util/validators.rb9
1 files changed, 5 insertions, 4 deletions
diff --git a/lib/axlsx/util/validators.rb b/lib/axlsx/util/validators.rb
index 2b4afd8d..71652ef2 100644
--- a/lib/axlsx/util/validators.rb
+++ b/lib/axlsx/util/validators.rb
@@ -56,13 +56,13 @@ module Axlsx
raise ArgumentError, (ERR_TYPE % [v.inspect, name, types.inspect]) unless other.call(v)
end
v_class = v.is_a?(Class) ? v : v.class
- Array(types).each do |t|
+ Array(types).each do |t|
return if v_class <= t
end
raise ArgumentError, (ERR_TYPE % [v.inspect, name, types.inspect])
end
end
-
+
# Requires that the value can be converted to an integer
# @para, [Any] v the value to validate
@@ -78,7 +78,8 @@ module Axlsx
def self.validate_angle(v)
raise ArgumentError, (ERR_ANGLE % v.inspect) unless (v.to_i >= -5400000 && v.to_i <= 5400000)
end
-
+
+ # Validates an unsigned intger
UINT_VALIDATOR = lambda { |arg| arg.respond_to?(:>=) && arg >= 0 }
# Requires that the value is a Integer and is greater or equal to 0
@@ -148,7 +149,7 @@ module Axlsx
RestrictionValidator.validate "cell run style u", [:none, :single, :double, :singleAccounting, :doubleAccounting], v
end
- # validates cell style family which must be between 1 and 5
+ # validates cell style family which must be between 1 and 5
def self.validate_family(v)
RestrictionValidator.validate "cell run style family", 1..5, v
end