diff options
| author | Randy Morgan <[email protected]> | 2012-05-03 18:41:43 +0900 |
|---|---|---|
| committer | Randy Morgan <[email protected]> | 2012-05-03 18:41:43 +0900 |
| commit | fabe7d771f5064b60aa68706ed0ea49b5d3ecc3d (patch) | |
| tree | 25f13e17bb72bb41462d8c4091c7d71066d5b497 /lib/axlsx/util/validators.rb | |
| parent | 4c4ef3cea3700fe0758542dc33ea4ab4bafbc809 (diff) | |
| download | caxlsx-fabe7d771f5064b60aa68706ed0ea49b5d3ecc3d.tar.gz caxlsx-fabe7d771f5064b60aa68706ed0ea49b5d3ecc3d.zip | |
use string casting and matching for regex validations.
Diffstat (limited to 'lib/axlsx/util/validators.rb')
| -rw-r--r-- | lib/axlsx/util/validators.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/axlsx/util/validators.rb b/lib/axlsx/util/validators.rb index 5dc1f66e..48f99877 100644 --- a/lib/axlsx/util/validators.rb +++ b/lib/axlsx/util/validators.rb @@ -20,7 +20,7 @@ module Axlsx # @param [Regexp] regex The regular expression to evaluate # @param [Any] v The value to validate. def self.validate(name, regex, v) - raise ArgumentError, (ERR_REGEX % [v.inspect, regex.to_s]) unless (v.respond_to?(:=~) && v =~ regex) + raise ArgumentError, (ERR_REGEX % [v.inspect, regex.to_s]) unless (v.respond_to?(:to_s) && v.to_s.match(regex)) end end # Validate that the class of the value provided is either an instance or the class of the allowed types and that any specified additional validation returns true. |
