diff options
| author | Zsolt Kozaroczy <[email protected]> | 2023-06-13 16:15:27 +0200 |
|---|---|---|
| committer | GitHub <[email protected]> | 2023-06-13 16:15:27 +0200 |
| commit | e74c75b95d39fb51512387031e79f50e52a5874a (patch) | |
| tree | 6b8ccc2cea0cbdc9c9255e986daf2c7dcbe0d4c5 /lib/axlsx/util/validators.rb | |
| parent | 63a58ba6e35f4807710ba5d8935400d7e502cb30 (diff) | |
| parent | dd391d24da8e29525fe2c86ea7c32c1f76cfa938 (diff) | |
| download | caxlsx-e74c75b95d39fb51512387031e79f50e52a5874a.tar.gz caxlsx-e74c75b95d39fb51512387031e79f50e52a5874a.zip | |
Merge pull request #283 from tagliala/chore/lambda-style
Fix safe Style/Lambda offenses
Diffstat (limited to 'lib/axlsx/util/validators.rb')
| -rw-r--r-- | lib/axlsx/util/validators.rb | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/axlsx/util/validators.rb b/lib/axlsx/util/validators.rb index 8533145d..fd17360e 100644 --- a/lib/axlsx/util/validators.rb +++ b/lib/axlsx/util/validators.rb @@ -83,7 +83,7 @@ module Axlsx end # Validates an unsigned intger - UINT_VALIDATOR = lambda { |arg| arg.respond_to?(:>=) && arg >= 0 } + UINT_VALIDATOR = ->(arg) { arg.respond_to?(:>=) && arg >= 0 } # Requires that the value is a Integer and is greater or equal to 0 # @param [Any] v The value validated @@ -109,7 +109,7 @@ module Axlsx VALID_BOOLEAN_CLASSES = [TrueClass, FalseClass, Integer, String, Symbol].freeze VALID_BOOLEAN_VALUES = [true, false, 1, 0, '1', '0', 'true', 'false', :true, :false].freeze - BOOLEAN_VALIDATOR = lambda { |arg| VALID_BOOLEAN_VALUES.include?(arg) } + BOOLEAN_VALIDATOR = ->(arg) { VALID_BOOLEAN_VALUES.include?(arg) } # Requires that the value is a form that can be evaluated as a boolean in an xml document. # The value must be an instance of String, Integer, Symbol, TrueClass or FalseClass and @@ -137,14 +137,14 @@ module Axlsx RegexValidator.validate "number_with_unit", /\A[0-9]+(\.[0-9]+)?(mm|cm|in|pt|pc|pi)\Z/, v end - SCALE_10_400_VALIDATOR = lambda { |arg| arg >= 10 && arg <= 400 } + SCALE_10_400_VALIDATOR = ->(arg) { arg >= 10 && arg <= 400 } # Requires that the value is an integer ranging from 10 to 400. def self.validate_scale_10_400(v) DataTypeValidator.validate "page_scale", Integer, v, SCALE_10_400_VALIDATOR end - SCALE_0_10_400_VALIDATOR = lambda { |arg| arg == 0 || (arg >= 10 && arg <= 400) } + SCALE_0_10_400_VALIDATOR = ->(arg) { arg == 0 || (arg >= 10 && arg <= 400) } # Requires that the value is an integer ranging from 10 to 400 or 0. def self.validate_scale_0_10_400(v) |
