Class Whois::Client
In: lib/whois/client.rb
lib/whois/client.rb
Parent: Object

Methods

new   new   query   query  

Classes and Modules

Class Whois::Client::Query

Constants

DEFAULT_TIMEOUT = 10   The maximum time to run a whois query expressed in seconds
DEFAULT_TIMEOUT = 10   The maximum time to run a whois query expressed in seconds

Attributes

timeout  [RW] 
timeout  [RW] 

Public Class methods

Initializes a new Whois::Client with options.

If block is given, yields self.

  client = Whois::Client.new do |c|
    c.timeout = nil
  end
  client.query("google.com")

[Source]

# File lib/whois/client.rb, line 44
    def initialize(options = {}, &block)
      self.timeout = options[:timeout] || DEFAULT_TIMEOUT
      yield(self) if block_given?
    end

Initializes a new Whois::Client with options.

If block is given, yields self.

  client = Whois::Client.new do |c|
    c.timeout = nil
  end
  client.query("google.com")

[Source]

# File lib/whois/client.rb, line 44
    def initialize(options = {}, &block)
      self.timeout = options[:timeout] || DEFAULT_TIMEOUT
      yield(self) if block_given?
    end

Public Instance methods

Queries the right whois server for qstring and returns a Whois::Answer instance containing the response from the server.

  client.query("google.com")
  # => #<Whois::Answer>

[Source]

# File lib/whois/client.rb, line 68
    def query(qstring)
      string = qstring.to_s
      Timeout::timeout(timeout) do
        @server = Server.guess(string)
        @server.query(string)
      end
    end

Queries the right whois server for qstring and returns a Whois::Answer instance containing the response from the server.

  client.query("google.com")
  # => #<Whois::Answer>

[Source]

# File lib/whois/client.rb, line 68
    def query(qstring)
      string = qstring.to_s
      Timeout::timeout(timeout) do
        @server = Server.guess(string)
        @server.query(string)
      end
    end

[Validate]