From 950bd404904321ba5d12b55b144ad6a1e6a5354e Mon Sep 17 00:00:00 2001 From: Geremia Taglialatela Date: Tue, 23 May 2023 17:50:23 +0200 Subject: Improve Regexp validator Replace `.match` with `.match?` --- lib/axlsx/util/validators.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/axlsx/util/validators.rb b/lib/axlsx/util/validators.rb index 72e3f2d8..695d28ad 100644 --- a/lib/axlsx/util/validators.rb +++ b/lib/axlsx/util/validators.rb @@ -41,7 +41,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?(:to_s) && v.to_s.match(regex)) + raise ArgumentError, (ERR_REGEX % [v.inspect, regex.to_s]) unless (v.respond_to?(:to_s) && regex.match?(v.to_s)) end end -- cgit v1.2.3