diff options
| author | Randy Morgan <[email protected]> | 2012-05-08 20:28:52 +0900 |
|---|---|---|
| committer | Randy Morgan <[email protected]> | 2012-05-08 20:28:52 +0900 |
| commit | 7aa25770f1d92a2b4aa2c20ef9eabf24920052f1 (patch) | |
| tree | 4b7a983cf1954b5d681ca0909b47bd60d1152dcf /lib/axlsx/util/validators.rb | |
| parent | 90401b4e3d1ce641646498dd72c20ecbc205bb63 (diff) | |
| download | caxlsx-7aa25770f1d92a2b4aa2c20ef9eabf24920052f1.tar.gz caxlsx-7aa25770f1d92a2b4aa2c20ef9eabf24920052f1.zip | |
documentation for comments.
Diffstat (limited to 'lib/axlsx/util/validators.rb')
| -rw-r--r-- | lib/axlsx/util/validators.rb | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/lib/axlsx/util/validators.rb b/lib/axlsx/util/validators.rb index 4387aae5..e5d2c79a 100644 --- a/lib/axlsx/util/validators.rb +++ b/lib/axlsx/util/validators.rb @@ -45,8 +45,20 @@ module Axlsx true end + + # Requires that the value can be converted to an integer + # @para, [Any] v the value to validate + # @raise [ArgumentError] raised if the value cannot be converted to an integer + def self.validate_integerish(v) + raise ArugumentError, (ERR_INTEGERISH % v.inspect) unless (v.to_i.is_a?(Integer)) + end + + # Requires that the value is between -54000000 and 54000000 + # @param [Any] v The value validated + # @raise [ArgumentError] raised if the value cannot be converted to an integer between the allowed angle values for chart label rotation. + # @return [Boolean] true if the data is valid def self.validate_angle(v) - raise ArgumentError, (ERR_ANGLE % v.inspect) unless (v >= -5400000 && v <= 5400000) + raise ArgumentError, (ERR_ANGLE % v.inspect) unless (v.to_i >= -5400000 && v.to_i <= 5400000) end # Requires that the value is a Fixnum or Integer and is greater or equal to 0 # @param [Any] v The value validated |
