Sha256: 13356faba7e9ae27ea1164e4b229e5078d922067faa10e814e0cdb7cc08dcd39

Contents?: true

Size: 461 Bytes

Versions: 42

Compression:

Stored size: 461 Bytes

Contents

class EmailValidator < ActiveModel::EachValidator
  def validate_each(record, attribute, value)
    unless value =~ %r{\A(([A-Za-z0-9]+_+)|
                          ([A-Za-z0-9]+\-+)|
                          ([A-Za-z0-9]+\.+)|
                          ([A-Za-z0-9]+\++))*[A-Za-z0-9_]+@((\w+\-+)|
                          (\w+\.))*\w{1,63}\.[a-zA-Z]{2,6}\z}xi
      record.errors.add(attribute, :invalid, { value: value }.merge!(options))
    end
  end
end

Version data entries

42 entries across 42 versions & 1 rubygems

Version Path
spree_core-3.2.9 lib/spree/core/validators/email.rb
spree_core-3.1.14 lib/spree/core/validators/email.rb
spree_core-3.2.8 lib/spree/core/validators/email.rb
spree_core-3.1.13 lib/spree/core/validators/email.rb
spree_core-3.2.7 lib/spree/core/validators/email.rb
spree_core-3.1.12 lib/spree/core/validators/email.rb
spree_core-3.2.6 lib/spree/core/validators/email.rb
spree_core-3.1.11 lib/spree/core/validators/email.rb
spree_core-3.1.10 lib/spree/core/validators/email.rb
spree_core-3.2.5 lib/spree/core/validators/email.rb
spree_core-3.1.9 lib/spree/core/validators/email.rb
spree_core-3.2.4 lib/spree/core/validators/email.rb
spree_core-3.1.8 lib/spree/core/validators/email.rb
spree_core-3.1.7 lib/spree/core/validators/email.rb
spree_core-3.2.3 lib/spree/core/validators/email.rb
spree_core-3.2.2 lib/spree/core/validators/email.rb
spree_core-3.1.6 lib/spree/core/validators/email.rb
spree_core-3.1.5 lib/spree/core/validators/email.rb
spree_core-3.2.1 lib/spree/core/validators/email.rb
spree_core-3.2.0 lib/spree/core/validators/email.rb