Sha256: 5b3aeb7cbfe42ef20c5e50c4ae47e978fefa62161b29f90f78ba85e2b240f993

Contents?: true

Size: 364 Bytes

Versions: 16

Compression:

Stored size: 364 Bytes

Contents

# frozen_string_literal: true

module Truemail
  module Dns
    PunycodeRepresenter = Class.new do
      require 'simpleidn'

      def self.call(email)
        return unless email.is_a?(::String)
        return email if email.ascii_only?
        user, domain = email.split('@')
        "#{user}@#{SimpleIDN.to_ascii(domain.downcase)}"
      end
    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
truemail-2.5.0 lib/truemail/dns/punycode_representer.rb
truemail-2.4.9 lib/truemail/dns/punycode_representer.rb
truemail-2.4.8 lib/truemail/dns/punycode_representer.rb
truemail-2.4.7 lib/truemail/dns/punycode_representer.rb
truemail-2.4.6 lib/truemail/dns/punycode_representer.rb
truemail-2.4.5 lib/truemail/dns/punycode_representer.rb
truemail-2.4.4 lib/truemail/dns/punycode_representer.rb
truemail-2.4.3 lib/truemail/dns/punycode_representer.rb
truemail-2.4.2 lib/truemail/dns/punycode_representer.rb
truemail-2.4.1 lib/truemail/dns/punycode_representer.rb
truemail-2.4.0 lib/truemail/dns/punycode_representer.rb
truemail-2.3.4 lib/truemail/dns/punycode_representer.rb
truemail-2.3.3 lib/truemail/dns/punycode_representer.rb
truemail-2.3.2 lib/truemail/dns/punycode_representer.rb
truemail-2.3.1 lib/truemail/dns/punycode_representer.rb
truemail-2.3.0 lib/truemail/dns/punycode_representer.rb