Class Dnsruby::Config
In: lib/Dnsruby/Config.rb
Parent: Object

Description

 The Config class determines the system configuration for DNS.
 In particular, it determines the nameserver to target queries to.

 It also specifies whether and how the search list and default
 domain should be applied to queries, according to the following
 algorithm :
  • If the name is absolute, then it is used as is.
  • If the name is not absolute, then :
       If apply_domain is true, and ndots is greater than the number
       of labels in the name, then the default domain is added to the name.
    
       If apply_search_list is true, then each member of the search list
       is appended to the name.
    

Methods

add_nameserver   domain   domain=   nameserver=   ndots=   new   reset   search   search=   set_config_info   to_s  

Attributes

apply_domain  [RW]  Should the default domain be applied?
apply_search_list  [RW]  Should the search list be applied?
nameserver  [R]  The list of nameservers to query
ndots  [R]  The minimum number of labels in the query name (if it is not absolute) before it is considered complete

Public Class methods

Create a new Config with system default values

Reset the config to default values

Public Instance methods

Add a nameserver to the list of nameservers.

Can take either a single String or an array of Strings. The new nameservers are added at a higher priority.

Return the default domain

Set the default domain

Set the config to point to a single nameserver

Set ndots

Return the search path

Set the default search path

Set the config. Parameter can be :

  • A String containing the name of the config file to load
         e.g. /etc/resolv.conf
    
  • A hash with the following elements :
         nameserver (String)
         domain (String)
         search (String)
         ndots (Fixnum)
    

This method should not normally be called by client code.

[Validate]