21
1
Fork 0
mirror of https://github.com/Evolix/chexpire.git synced 2024-05-08 11:38:38 +02:00
chexpire/app/services/whois/parser.rb
2018-06-05 16:39:08 +02:00

21 lines
468 B
Ruby

require "null_logger"
require "whois/errors"
require "whois/parser/fr"
require "whois/parser/verisign"
module Whois
module Parser
PARSERS = [Fr, 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