Class: MCollective::Validator::ShellsafeValidator
- Inherits:
-
Object
- Object
- MCollective::Validator::ShellsafeValidator
- Defined in:
- lib/mcollective/validator/shellsafe_validator.rb
Class Method Summary collapse
Class Method Details
.validate(validator) ⇒ Object
4 5 6 7 8 9 10 |
# File 'lib/mcollective/validator/shellsafe_validator.rb', line 4 def self.validate(validator) raise ValidatorError, "value should be a String" unless validator.is_a?(String) ['`', '$', ';', '|', '&&', '>', '<'].each do |chr| raise ValidatorError, "value should not have #{chr} in it" if validator.match(Regexp.escape(chr)) end end |