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.3.0.pre4 lib/email_validator.rb
artfully_ose-1.3.0.pre3 lib/email_validator.rb
artfully_ose-1.3.0.pre2 lib/email_validator.rb
artfully_ose-1.3.0.pre1 lib/email_validator.rb
artfully_ose-1.2.0 lib/email_validator.rb
artfully_ose-1.2.0.beta.1 lib/email_validator.rb
artfully_ose-1.2.0.alpha.2 lib/email_validator.rb
artfully_ose-1.2.0.alpha.1 lib/email_validator.rb
artfully_ose-1.2.0.pre.27 lib/email_validator.rb
artfully_ose-1.2.0.pre.26 lib/email_validator.rb
artfully_ose-1.2.0.pre.24 lib/email_validator.rb
artfully_ose-1.2.0.pre.23 lib/email_validator.rb
artfully_ose-1.2.0.pre.21 lib/email_validator.rb
artfully_ose-1.2.0.pre.20 lib/email_validator.rb
artfully_ose-1.2.0.pre.19 lib/email_validator.rb
artfully_ose-1.2.0.pre.18 lib/email_validator.rb
artfully_ose-1.2.0.pre.17 lib/email_validator.rb
artfully_ose-1.2.0.pre.16 lib/email_validator.rb
artfully_ose-1.2.0.pre.15 lib/email_validator.rb
artfully_ose-1.2.0.pre.12 lib/email_validator.rb