# Resolv (Class)

In: | resolv.rb
Parent: | Object

## Methods

each_address each_address each_name each_name getaddress getaddress getaddresses getaddresses getname getname getnames getnames new

## Constants

DefaultResolver | = | self.new
AddressRegex | = | /(?:#{IPv4::Regex.source})|(?:#{IPv6::Regex.source})/

## Classes and Modules

Class Resolv::DNS
::Module Resolv::DNS::Label
:: ::Class Resolv::DNS::Label::Str
::Module Resolv::DNS::OpCode
::Module Resolv::DNS::RCode
::Class Resolv::DNS::Config
:: ::Class Resolv::DNS::Config::NXDomain
:: ::Class Resolv::DNS::Config::OtherResolvError
::Class Resolv::DNS::DecodeError
::Class Resolv::DNS::EncodeError
::Class Resolv::DNS::Message
:: ::Class Resolv::DNS::Message::MessageDecoder
:: ::Class Resolv::DNS::Message::MessageEncoder
::Class Resolv::DNS::Name
::Class Resolv::DNS::Query
::Class Resolv::DNS::Requester
:: ::Class Resolv::DNS::Requester::ConnectedUDP
:: :: ::Class Resolv::DNS::Requester::ConnectedUDP::Sender
:: ::Class Resolv::DNS::Requester::RequestError
:: ::Class Resolv::DNS::Requester::Sender
:: ::Class Resolv::DNS::Requester::TCP
:: :: ::Class Resolv::DNS::Requester::TCP::Sender
:: ::Class Resolv::DNS::Requester::UnconnectedUDP
:: :: ::Class Resolv::DNS::Requester::UnconnectedUDP::Sender
::Class Resolv::DNS::Resource
:: ::Module Resolv::DNS::Resource::IN
:: :: ::Class Resolv::DNS::Resource::IN::A
:: :: ::Class Resolv::DNS::Resource::IN::AAAA
:: :: ::Class Resolv::DNS::Resource::IN::WKS
:: ::Class Resolv::DNS::Resource::ANY
:: ::Class Resolv::DNS::Resource::CNAME
:: ::Class Resolv::DNS::Resource::DomainName
:: ::Class Resolv::DNS::Resource::Generic
:: ::Class Resolv::DNS::Resource::HINFO
:: ::Class Resolv::DNS::Resource::MINFO
:: ::Class Resolv::DNS::Resource::MX
:: ::Class Resolv::DNS::Resource::NS
:: ::Class Resolv::DNS::Resource::PTR
:: ::Class Resolv::DNS::Resource::SOA
:: ::Class Resolv::DNS::Resource::TXT
Class Resolv::Hosts
Class Resolv::IPv4
Class Resolv::IPv6
Class Resolv::ResolvError
Class Resolv::ResolvTimeout

## Public Class methods

getaddress(name)

[Source]

    # File resolv.rb, line 190
      def self.getaddress(name)
        DefaultResolver.getaddress(name)
      end

getaddresses(name)

[Source]

    # File resolv.rb, line 194
      def self.getaddresses(name)
        DefaultResolver.getaddresses(name)
      end

each_address(name, &block)

[Source]

    # File resolv.rb, line 198
      def self.each_address(name, &block)
        DefaultResolver.each_address(name, &block)
      end

getname(address)

[Source]

    # File resolv.rb, line 202
      def self.getname(address)
        DefaultResolver.getname(address)
      end

getnames(address)

[Source]

    # File resolv.rb, line 206
      def self.getnames(address)
        DefaultResolver.getnames(address)
      end

each_name(address, &proc)

[Source]

    # File resolv.rb, line 210
      def self.each_name(address, &proc)
        DefaultResolver.each_name(address, &proc)
      end

new(resolvers=[Hosts.new, DNS.new])

[Source]

    # File resolv.rb, line 214
      def initialize(resolvers=[Hosts.new, DNS.new])
        @resolvers = resolvers
      end

## Public Instance methods

getaddress(name)

[Source]

    # File resolv.rb, line 218
      def getaddress(name)
        each_address(name) {|address| return address}
        raise ResolvError.new("no address for #{name}")
      end

getaddresses(name)

[Source]

    # File resolv.rb, line 223
      def getaddresses(name)
        ret = []
        each_address(name) {|address| ret << address}
        return ret
      end

each_address(name) {|name| ...}

[Source]

    # File resolv.rb, line 229
      def each_address(name)
        if AddressRegex =~ name
          yield name
          return
        end
        yielded = false
        @resolvers.each {|r|
          r.each_address(name) {|address|
            yield address.to_s
            yielded = true
          }
          return if yielded
        }
      end

getname(address)

[Source]

    # File resolv.rb, line 244
      def getname(address)
        each_name(address) {|name| return name}
        raise ResolvError.new("no name for #{address}")
      end

getnames(address)

[Source]

    # File resolv.rb, line 249
      def getnames(address)
        ret = []
        each_name(address) {|name| ret << name}
        return ret
      end

each_name(address) {|name.to_s| ...}

[Source]

    # File resolv.rb, line 255
      def each_name(address)
        yielded = false
        @resolvers.each {|r|
          r.each_name(address) {|name|
            yield name.to_s
            yielded = true
          }
          return if yielded
        }
      end

[Validate]