module Whois::ParserExtensions::Whois::ClassMethods

Public Instance Methods

available?(object) click to toggle source

Checks whether the object represented by object is available.

Warning: this method is only available if a Whois parser exists for the top level domain of object. If no parser exists for object, you'll receive a warning message and the method will return nil. This is a technical limitation. Browse the lib/whois/record/parsers folder to view all available parsers.

@param [String] object The string to be sent as query parameter.

It is intended to be a domain name, otherwise this method
may return unexpected responses.

@return [Boolean]

@example

Whois.available?("google.com")
# => false

@example

Whois.available?("google-is-not-available-try-again-later.com")
# => true
# File lib/whois/parser_extensions/whois.rb, line 35
def available?(object)
  result = lookup(object).available?
  if result.nil?
    warn  "This method is not supported for this kind of object.\n" +
          "Use Whois.lookup('#{object}') instead."
  end
  result
end
registered?(object) click to toggle source

Checks whether the object represented by object is registered.

Warning: this method is only available if a Whois parser exists for the top level domain of object. If no parser exists for object, you'll receive a warning message and the method will return nil. This is a technical limitation. Browse the lib/whois/record/parsers folder to view all available parsers.

@param [String] object The string to be sent as query parameter.

It is intended to be a domain name, otherwise this method
may return unexpected responses.

@return [Boolean]

@example

Whois.registered?("google.com")
# => true

@example

Whois.registered?("google-is-not-available-try-again-later.com")
# => false
# File lib/whois/parser_extensions/whois.rb, line 66
def registered?(object)
  result = lookup(object).registered?
  if result.nil?
    warn  "This method is not supported for this kind of object.\n" +
          "Use Whois.lookup('#{object}') instead."
  end
  result
end