Class: Validations::Validation

Inherits:
Object
  • Object
show all
Defined in:
lib/dew/validations.rb

Class Method Summary collapse

Class Method Details

.validates_format_of(string, regex) ⇒ Object

Raises:

  • (ArgumentError)


4
5
6
# File 'lib/dew/validations.rb', line 4

def self.validates_format_of string, regex
  raise ArgumentError, "Validation error. '#{string}' does not match '#{regex.inspect}'" unless regex.match(string)
end