Sha256: 2a1ab58af64b818d9ee3eafc0d558030417ee56334bbe03b27da12fcc9f6717a

Contents?: true

Size: 247 Bytes

Versions: 35

Compression:

Stored size: 247 Bytes

Contents

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

Version data entries

35 entries across 35 versions & 1 rubygems

Version Path
artfully_ose-1.2.0.pre.11 lib/email_validator.rb
artfully_ose-1.2.0.pre.10 lib/email_validator.rb
artfully_ose-1.2.0.pre.9 lib/email_validator.rb
artfully_ose-1.2.0.pre.8 lib/email_validator.rb
artfully_ose-1.2.0.pre.7 lib/email_validator.rb
artfully_ose-1.2.0.pre.6 lib/email_validator.rb
artfully_ose-1.2.0.pre.5 lib/email_validator.rb
artfully_ose-1.2.0.pre.4 lib/email_validator.rb
artfully_ose-1.2.0.pre.3 lib/email_validator.rb
artfully_ose-1.2.0.pre.2 lib/email_validator.rb
artfully_ose-1.2.0.pre.1 lib/email_validator.rb
artfully_ose-1.2.0.pre lib/email_validator.rb
artfully_ose-1.1.0 lib/email_validator.rb
artfully_ose-1.1.0.rc2 lib/email_validator.rb
artfully_ose-1.1.0.rc1 lib/email_validator.rb