Class: Ducktape::RegexpValidator
- Inherits:
-
Object
- Object
- Ducktape::RegexpValidator
- Defined in:
- lib/ducktape/validators/regexp_validator.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(regexp) ⇒ RegexpValidator
constructor
A new instance of RegexpValidator.
- #validate(obj) ⇒ Object
Constructor Details
#initialize(regexp) ⇒ RegexpValidator
Returns a new instance of RegexpValidator.
3 4 5 |
# File 'lib/ducktape/validators/regexp_validator.rb', line 3 def initialize(regexp) @regexp = regexp end |
Class Method Details
.matches?(obj) ⇒ Boolean
11 12 13 |
# File 'lib/ducktape/validators/regexp_validator.rb', line 11 def self.matches?(obj) obj.is_a?(Regexp) end |
Instance Method Details
#validate(obj) ⇒ Object
7 8 9 |
# File 'lib/ducktape/validators/regexp_validator.rb', line 7 def validate(obj) obj =~ @regexp end |