In Files

  • resolv.rb

Resolv

Public Class Methods

each_address(name, &block) click to toggle source
 
               # File resolv.rb, line 211
def self.each_address(name, &block)
  DefaultResolver.each_address(name, &block)
end
            
each_name(address, &proc) click to toggle source
 
               # File resolv.rb, line 223
def self.each_name(address, &proc)
  DefaultResolver.each_name(address, &proc)
end
            
getaddress(name) click to toggle source
 
               # File resolv.rb, line 203
def self.getaddress(name)
  DefaultResolver.getaddress(name)
end
            
getaddresses(name) click to toggle source
 
               # File resolv.rb, line 207
def self.getaddresses(name)
  DefaultResolver.getaddresses(name)
end
            
getname(address) click to toggle source
 
               # File resolv.rb, line 215
def self.getname(address)
  DefaultResolver.getname(address)
end
            
getnames(address) click to toggle source
 
               # File resolv.rb, line 219
def self.getnames(address)
  DefaultResolver.getnames(address)
end
            
new(resolvers=[Hosts.new, DNS.new]) click to toggle source
 
               # File resolv.rb, line 227
def initialize(resolvers=[Hosts.new, DNS.new])
  @resolvers = resolvers
end
            

Public Instance Methods

each_address(name) click to toggle source
 
               # File resolv.rb, line 242
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
            
each_name(address) click to toggle source
 
               # File resolv.rb, line 268
def each_name(address)
  yielded = false
  @resolvers.each {|r|
    r.each_name(address) {|name|
      yield name.to_s
      yielded = true
    }
    return if yielded
  }
end
            
getaddress(name) click to toggle source
 
               # File resolv.rb, line 231
def getaddress(name)
  each_address(name) {|address| return address}
  raise ResolvError.new("no address for #{name}")
end
            
getaddresses(name) click to toggle source
 
               # File resolv.rb, line 236
def getaddresses(name)
  ret = []
  each_address(name) {|address| ret << address}
  return ret
end
            
getname(address) click to toggle source
 
               # File resolv.rb, line 257
def getname(address)
  each_name(address) {|name| return name}
  raise ResolvError.new("no name for #{address}")
end
            
getnames(address) click to toggle source
 
               # File resolv.rb, line 262
def getnames(address)
  ret = []
  each_name(address) {|name| ret << name}
  return ret
end
            

Commenting is here to help enhance the documentation. For example, code samples, or clarification of the documentation.

If you have questions about Ruby or the documentation, please post to one of the Ruby mailing lists. You will get better, faster, help that way.

If you wish to post a correction of the docs, please do so, but also file bug report so that it can be corrected for the next release. Thank you.

If you want to help improve the Ruby documentation, please visit Documenting-ruby.org.

blog comments powered by Disqus