Updated mcollective.init according to OSCI-658
[packages/precise/mcollective.git] / plugins / mcollective / validator / length_validator.rb
diff --git a/plugins/mcollective/validator/length_validator.rb b/plugins/mcollective/validator/length_validator.rb
new file mode 100644 (file)
index 0000000..78ecb93
--- /dev/null
@@ -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