class Dns::CatalogZone::Setting

The Setting class is basic config class

Public Class Methods

new(name) click to toggle source
# File lib/dns/catalog_zone/config.rb, line 27
def initialize(name)
  @attributes = { 'name' => name, 'software' => 'nsd',
                  'source' => 'file', 'output' => 'stdout',
                  'zonename' => 'catalog.example', 'zonepath' => '%s',
                  'output_path' => 'catalog.conf', 'port' => 53,
                  'timeout' => 30 }
end

Public Instance Methods

method_missing(method_name, *params) click to toggle source
# File lib/dns/catalog_zone/config.rb, line 35
def method_missing(method_name, *params)
  name = method_name.to_s
  if (md = name.to_s.match(/([a-zA-Z0-9][a-zA-Z0-9_-]*[a-zA-Z0-9])=$/))
    @attributes[md[1]] = params[0]
  elsif name.to_s =~ /([a-zA-Z0-9][a-zA-Z0-9_-]*[a-zA-Z0-9])$/
    @attributes[name]
  else
    raise ValidateError
  end
end
validate() click to toggle source
# File lib/dns/catalog_zone/config.rb, line 46
def validate
  Source.create(self).validate
  Provider.create(self).validate
  Output.create(self).validate
end