class FakeEmailValidator

Constants

I18N_SCOPE

Public Class Methods

new(options) click to toggle source
Calls superclass method
# File lib/fake_email_validator.rb, line 12
def initialize(options)
  super(options)
end

Public Instance Methods

validate_each(record, attribute, value) click to toggle source
# File lib/fake_email_validator.rb, line 16
def validate_each(record, attribute, value)
  record.errors.add attribute, I18n.t(:fake, scope: I18N_SCOPE) if fake_email_service.is_fake_email?(value)
rescue Mail::Field::ParseError
  record.errors.add attribute, I18n.t(:invalid, scope: I18N_SCOPE)
end