X-Git-Url: https://review.fuel-infra.org/gitweb?a=blobdiff_plain;f=plugins%2Fmcollective%2Fvalidator%2Flength_validator.rb;fp=plugins%2Fmcollective%2Fvalidator%2Flength_validator.rb;h=78ecb939d8937db8926650cf655bdb4d3d57ae0d;hb=b87d2f4e68281062df1913440ca5753ae63314a9;hp=0000000000000000000000000000000000000000;hpb=ab0ea530b8ac956091f17b104ab2311336cfc250;p=packages%2Fprecise%2Fmcollective.git diff --git a/plugins/mcollective/validator/length_validator.rb b/plugins/mcollective/validator/length_validator.rb new file mode 100644 index 0000000..78ecb93 --- /dev/null +++ b/plugins/mcollective/validator/length_validator.rb @@ -0,0 +1,11 @@ +module MCollective + module Validator + class LengthValidator + def self.validate(validator, length) + if (validator.size > length) && (length > 0) + raise ValidatorError, "Input string is longer than #{length} character(s)" + end + end + end + end +end