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.2.6 lib/virgo/email_validator.rb
virgo-0.2.5 lib/virgo/email_validator.rb
virgo-0.2.4 lib/virgo/email_validator.rb
virgo-0.2.2 lib/virgo/email_validator.rb
virgo-0.2.1 lib/virgo/email_validator.rb
virgo-0.2 lib/virgo/email_validator.rb
virgo-0.1.16 lib/virgo/email_validator.rb
virgo-0.1.15 lib/virgo/email_validator.rb
virgo-0.1.14 lib/virgo/email_validator.rb
virgo-0.1.13 lib/virgo/email_validator.rb
virgo-0.1.12 lib/virgo/email_validator.rb
virgo-0.1.11 lib/virgo/email_validator.rb
virgo-0.1.10 lib/virgo/email_validator.rb
virgo-0.1.8 lib/virgo/email_validator.rb
virgo-0.1.7 lib/virgo/email_validator.rb
virgo-0.1.6 lib/virgo/email_validator.rb
virgo-0.1.5 lib/virgo/email_validator.rb
virgo-0.1.4 lib/virgo/email_validator.rb
virgo-0.1.2 lib/virgo/email_validator.rb
virgo-0.1.1 lib/virgo/email_validator.rb