Sha256: 022e0bd6ed231d15f921d6b871dd82e920c1f6d6818e33954abdce8f683f2e7a

Contents?: true

Size: 480 Bytes

Versions: 7

Compression:

Stored size: 480 Bytes

Contents

require 'active_model'
require 'active_model/validations'
require 'resolv'
require 'valid_email/validate_email'
class MxValidator < ActiveModel::EachValidator
  def self.config
    @@config = { timeouts: [] } unless defined? @@config

    @@config
  end

  def validate_each(record,attribute,value)
    r = ValidateEmail.mx_valid?(value)
    record.errors.add attribute, (options[:message] || I18n.t(:invalid, :scope => "valid_email.validations.email")) unless r

    r
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
valid_email-0.2.1 lib/valid_email/mx_validator.rb
valid_email-0.2.0 lib/valid_email/mx_validator.rb
valid_email-0.1.4 lib/valid_email/mx_validator.rb
valid_email-0.1.3 lib/valid_email/mx_validator.rb
valid_email-0.1.2 lib/valid_email/mx_validator.rb
valid_email-0.1.1 lib/valid_email/mx_validator.rb
valid_email-0.1.0 lib/valid_email/mx_validator.rb