module Dns::CatalogZone

Dns::CatalogZone

CatalogZone module

Constants

VERSION

Public Class Methods

convert_path(format, zonename) click to toggle source

%s zone name %h zone hash %S(1) first character %S(2) second character %S(3) third character %L(1) top label %L(2) second label %H(1) zone name hash 1 character %H(2) zone name hash 2 character

# File lib/dns/catalog_zone/helper.rb, line 45
def convert_path(format, zonename)
  mhash = Digest::SHA1.hexdigest(zonename.canonical)
  path = format.clone
  path.gsub!(/%S\(1\)/, zonename.to_s[0])
  path.gsub!(/%S\(2\)/, zonename.to_s[1])
  path.gsub!(/%S\(3\)/, zonename.to_s[2])
  path.gsub!(/%L\(1\)/, zonename.labels[zonename.labels.size - 1].to_s)
  path.gsub!(/%L\(2\)/, zonename.labels[zonename.labels.size - 2].to_s)
  path.gsub!(/%H\(1\)/, mhash[0])
  path.gsub!(/%H\(2\)/, mhash[1])
  path.gsub!(/%s/, zonename.to_s)
  path.gsub!(/%h/, mhash)
  path
end
root_path() click to toggle source
# File lib/dns/catalog_zone/helper.rb, line 35
def root_path
  File.expand_path('../../../../', __FILE__)
end

Public Instance Methods

apl_rr?(rr) click to toggle source
# File lib/dns/catalog_zone/helper.rb, line 72
def apl_rr?(rr)
  rr.type == Dnsruby::Types.APL
end
host_rr?(rr) click to toggle source
# File lib/dns/catalog_zone/helper.rb, line 60
def host_rr?(rr)
  rr.type == Dnsruby::Types.A || rr.type == Dnsruby::Types.AAAA
end
ptr_rr?(rr) click to toggle source
# File lib/dns/catalog_zone/helper.rb, line 68
def ptr_rr?(rr)
  rr.type == Dnsruby::Types.PTR
end
txt_rr?(rr) click to toggle source
# File lib/dns/catalog_zone/helper.rb, line 64
def txt_rr?(rr)
  rr.type == Dnsruby::Types.TXT
end