Class | Whois::Client |
In: |
lib/whois/client.rb
lib/whois/client.rb |
Parent: | Object |
timeout | [RW] | |
timeout | [RW] |
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")
# 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")
# File lib/whois/client.rb, line 44 def initialize(options = {}, &block) self.timeout = options[:timeout] || DEFAULT_TIMEOUT yield(self) if block_given? 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>
# 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>
# 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