21
1
Fork 0
mirror of https://github.com/Evolix/chexpire.git synced 2024-04-25 13:33:04 +02:00
chexpire/app/services/whois/parser.rb

27 lines
587 B
Ruby

# Copyright (C) 2018 Colin Darie <colin@darie.eu>, 2018 Evolix <info@evolix.fr>
# License: GNU AGPL-3+ (see full text in LICENSE file)
module Whois
module Parser
PARSERS = [
Afilias,
AFNIC,
CIRA,
IO,
Neustar,
Sonic,
Verisign,
].freeze
class << self
def for(domain, logger: NullLogger.new)
parser_class = PARSERS.find { |k| k.supports?(domain) }
fail UnsupportedDomainError, "Unsupported domain '#{domain}'" if parser_class.nil?
parser_class.new(domain, logger: logger)
end
end
end
end