mirror of
https://github.com/Evolix/chexpire.git
synced 2024-06-29 12:32:53 +02:00
20 lines
426 B
Ruby
20 lines
426 B
Ruby
|
require "null_logger"
|
||
|
require "whois/errors"
|
||
|
require "whois/parser/fr"
|
||
|
|
||
|
module Whois
|
||
|
module Parser
|
||
|
PARSERS = [Fr].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
|