lib/root_domain.rb in root_domain-0.1.0 vs lib/root_domain.rb in root_domain-0.1.1

- old
+ new

@@ -1,17 +1,18 @@ # frozen_string_literal: true +require "email_data" require "simpleidn" require "json" require "root_domain/version" module RootDomain def self.call(input) input = SimpleIDN.to_ascii(input) - find(slds, input) || find(tlds, input) + find(EmailData.slds, input) || find(EmailData.tlds, input) end def self.find(source, input) components = input.split(".") @@ -20,15 +21,7 @@ return components[(index - 1)..-1].join(".") end end nil - end - - def self.slds - @slds ||= JSON.parse(File.read("#{__dir__}/../data/slds.json")) - end - - def self.tlds - @tlds ||= JSON.parse(File.read("#{__dir__}/../data/tlds.json")) end end