Sha256: c7e89069e7b53512e9198735cd815cde33454f45b749ea5e60fe7ba34c4ae67d

Contents?: true

Size: 429 Bytes

Versions: 11

Compression:

Stored size: 429 Bytes

Contents

class EmailPatternValidator < ActiveModel::EachValidator  
  def validate_each(record, attribute, value)  
		unless value.match(/^([\w\!\#$\%\&\'\*\+\-\/\=\?\^\`{\|\}\~]+\.)*[\w\!\#$\%\&\'\*\+\-\/\=\?\^\`{\|\}\~]+@((((([a-z0-9]{1}[a-z0-9\-]{0,62}[a-z0-9]{1})|[a-z])\.)+[a-z]{2,6})|(\d{1,3}\.){3}\d{1,3}(\:\d{1,5})?)$/i)  
      record.errors[attribute] << "Not a valid email address"  
    end unless value.blank?    
  end  
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
stripe_local-0.2.5 app/validators/email_pattern_validator.rb
stripe_local-0.2.4 app/validators/email_pattern_validator.rb
stripe_local-0.2.3 app/validators/email_pattern_validator.rb
stripe_local-0.2.2 app/validators/email_pattern_validator.rb
stripe_local-0.2.1 app/validators/email_pattern_validator.rb
stripe_local-0.2.0 app/validators/email_pattern_validator.rb
stripe_local-0.1.3 app/validators/email_pattern_validator.rb
stripe_local-0.1.2 app/validators/email_pattern_validator.rb
stripe_local-0.1.1 app/validators/email_pattern_validator.rb
stripe_local-0.1.0 app/validators/email_pattern_validator.rb
stripe_local-0.0.2 app/validators/email_pattern_validator.rb