Class: Owasp::Esapi::Validator::GenericValidator
- Inherits:
-
Object
- Object
- Owasp::Esapi::Validator::GenericValidator
- Defined in:
- lib/validator/generic_validator.rb
Instance Attribute Summary collapse
-
#matcher ⇒ Object
Returns the value of attribute matcher.
Instance Method Summary collapse
-
#initialize(matcher) ⇒ GenericValidator
constructor
Creates a new generic validator.
-
#valid?(string) ⇒ Boolean
Validate a string against the matcher.
Constructor Details
#initialize(matcher) ⇒ GenericValidator
Creates a new generic validator.
11 12 13 |
# File 'lib/validator/generic_validator.rb', line 11 def initialize(matcher) @matcher = matcher end |
Instance Attribute Details
#matcher ⇒ Object
Returns the value of attribute matcher.
7 8 9 |
# File 'lib/validator/generic_validator.rb', line 7 def matcher @matcher end |
Instance Method Details
#valid?(string) ⇒ Boolean
Validate a string against the matcher
18 19 20 21 22 |
# File 'lib/validator/generic_validator.rb', line 18 def valid?(string) r = Regexp.new(@matcher) !(string =~ r).nil? end |