Sha256: 99238895228fd2608ecb5e26cdbf6e150eae5d654b024d57c3c87b088419e942

Contents?: true

Size: 553 Bytes

Versions: 2

Compression:

Stored size: 553 Bytes

Contents

# frozen_string_literal: true

require "email_inquire/validator/base"

module EmailInquire
  module Validator
    class CommonlyMistakenDomain < Base

      MISTAKES = {
        /google(?!mail)/ => "gmail.com",
        /windows.*\.com/ => "live.com",
      }.freeze

      def validate
        return response.valid! if MISTAKES.value?(domain)

        _mistake, reference =
          MISTAKES.find do |mistake, _reference|
            mistake =~ domain
          end

        response.hint!(domain: reference) if reference
      end

    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
email_inquire-0.11.0 lib/email_inquire/validator/commonly_mistaken_domain.rb
email_inquire-0.10.0 lib/email_inquire/validator/commonly_mistaken_domain.rb