Sha256: de2cb82f08b4021ca3e91e9d6c4656d58d3c5dc7322a1ec28b9e0b81a6ea0ad5

Contents?: true

Size: 253 Bytes

Versions: 41

Compression:

Stored size: 253 Bytes

Contents

class EmailValidator < ActiveModel::EachValidator
  def validate_each(record, attribute, value)
    record.errors.add(attribute, options[:message] || "has an invalid format") unless
      value =~ /\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\z/i
  end
end

Version data entries

41 entries across 41 versions & 1 rubygems

Version Path
virgo-0.3.17 lib/virgo/email_validator.rb
virgo-0.3.16 lib/virgo/email_validator.rb
virgo-0.3.15 lib/virgo/email_validator.rb
virgo-0.3.14 lib/virgo/email_validator.rb
virgo-0.3.13 lib/virgo/email_validator.rb
virgo-0.3.12 lib/virgo/email_validator.rb
virgo-0.3.11 lib/virgo/email_validator.rb
virgo-0.3.10 lib/virgo/email_validator.rb
virgo-0.3.9 lib/virgo/email_validator.rb
virgo-0.3.8 lib/virgo/email_validator.rb
virgo-0.3.7 lib/virgo/email_validator.rb
virgo-0.3.6 lib/virgo/email_validator.rb
virgo-0.3.4 lib/virgo/email_validator.rb
virgo-0.3.3 lib/virgo/email_validator.rb
virgo-0.3.2 lib/virgo/email_validator.rb
virgo-0.3.1 lib/virgo/email_validator.rb
virgo-0.3 lib/virgo/email_validator.rb
virgo-0.2.9 lib/virgo/email_validator.rb
virgo-0.2.8 lib/virgo/email_validator.rb
virgo-0.2.7 lib/virgo/email_validator.rb