Class: Ducktape::RegexpValidator

Inherits:
Object
  • Object
show all
Defined in:
lib/ducktape/validators/regexp_validator.rb

Class Method Summary collapse

Instance Method Summary collapse

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

Returns:

  • (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