Class: SexyValidations::Validators::Email

Inherits:
Object
  • Object
show all
Defined in:
lib/sexy_validations/validators/email.rb

Constant Summary collapse

REGEXP =
/^([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})$/i

Class Method Summary collapse

Class Method Details

.validate(record, attribute, value, options) ⇒ Object



7
8
9
10
11
12
13
# File 'lib/sexy_validations/validators/email.rb', line 7

def self.validate(record, attribute, value, options)
  return if value.blank?

  unless value =~ REGEXP
    record.errors.add(attribute, "ungültiges Format")
  end
end