resolver.rb

Path: lib/net/dns/resolver.rb
Last Update: Wed Nov 04 22:15:53 +0100 2009

Required files

rbconfig   socket   timeout   ipaddr   logger   net/dns/packet   net/dns/resolver/timeouts   win32/resolv  

Methods

Resolver  

External Aliases

send -> old_send

Public Instance methods

Resolver helper method

Calling the resolver directly:

  require 'net/dns/resolver'
  puts Resolver("www.google.com").answer.size
  #=> 5

An optional block can be passed yielding the Net::DNS::Packet object.

  Resolver("www.google.com") {|packet| puts packet.size + " bytes"}
  #=> 484 bytes

[Source]

# File lib/net/dns/resolver.rb, line 25
def Resolver(name,type=Net::DNS::A,cls=Net::DNS::IN,&blk)
  obj = Net::DNS::Resolver.start(name,type,cls)
  if block_given?
    yield obj
  else
    return obj
  end
end

[Validate]