21
1
Fork 0
mirror of https://github.com/Evolix/chexpire.git synced 2024-06-29 12:32:53 +02:00
chexpire/app/services/whois/parser.rb

21 lines
468 B
Ruby
Raw Normal View History

2018-05-30 12:04:07 +02:00
require "null_logger"
require "whois/errors"
require "whois/parser/fr"
2018-06-05 16:39:08 +02:00
require "whois/parser/verisign"
2018-05-30 12:04:07 +02:00
module Whois
module Parser
2018-06-05 16:39:08 +02:00
PARSERS = [Fr, Verisign].freeze
2018-05-30 12:04:07 +02:00
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