summaryrefslogtreecommitdiffhomepage
path: root/lib/axlsx/util/validators.rb
diff options
context:
space:
mode:
authorGeremia Taglialatela <[email protected]>2023-06-05 17:14:59 +0200
committerGeremia Taglialatela <[email protected]>2023-06-05 17:27:41 +0200
commitb0fb7d1f19afbc933b3aa445f5d95d4b6bef9f6b (patch)
treea50309ea3b0db8a2de8d3f6985ba29de3b826f5a /lib/axlsx/util/validators.rb
parent0cc60e3eb08e11542612871e2e15350ed07fff06 (diff)
downloadcaxlsx-b0fb7d1f19afbc933b3aa445f5d95d4b6bef9f6b.tar.gz
caxlsx-b0fb7d1f19afbc933b3aa445f5d95d4b6bef9f6b.zip
Prefer `Kernel#format` to `String#%`
This commit fixes cases that cannot be detected by RuboCop Ref: https://www.rubydoc.info/gems/rubocop/RuboCop/Cop/Style/FormatString
Diffstat (limited to 'lib/axlsx/util/validators.rb')
-rw-r--r--lib/axlsx/util/validators.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/axlsx/util/validators.rb b/lib/axlsx/util/validators.rb
index 1357f4f3..8533145d 100644
--- a/lib/axlsx/util/validators.rb
+++ b/lib/axlsx/util/validators.rb
@@ -71,7 +71,7 @@ module Axlsx
# @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 ArgumentError, (ERR_INTEGERISH % v.inspect) unless v.respond_to?(:to_i) && v.to_i.is_a?(Integer)
+ raise ArgumentError, format(ERR_INTEGERISH, v.inspect) unless v.respond_to?(:to_i) && v.to_i.is_a?(Integer)
end
# Requires that the value is between -54000000 and 54000000
@@ -79,7 +79,7 @@ module Axlsx
# @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.to_i >= -5400000 && v.to_i <= 5400000
+ raise ArgumentError, format(ERR_ANGLE, v.inspect) unless v.to_i >= -5400000 && v.to_i <= 5400000
end
# Validates an unsigned intger