class Zt::Importers::BaseImporter
Attributes
networks[RW]
nodes[RW]
Public Class Methods
new(networks, nodes)
click to toggle source
# File lib/zt/importers/_base_importer.rb, line 10 def initialize(networks, nodes) @networks = networks @nodes = nodes end
Public Instance Methods
import()
click to toggle source
# File lib/zt/importers/_base_importer.rb, line 15 def import abort('import called on non-functional superclass importer') end
Private Instance Methods
dnsify(input)
click to toggle source
# File lib/zt/importers/_base_importer.rb, line 21 def dnsify(input) zt_conf = Zt::Conf.instance.conf.zt tld_key = 'top_level_domains' tld = if zt_conf.key?(tld_key) && !zt_conf[tld_key].empty? zt_conf[tld_key] else 'zt' end clean = input.tr('-', '_') clean = clean.gsub(/([\W])/, '-') clean = clean.tr('_', '-') clean = clean.gsub(/(-+)/, '-') clean = "network-#{clean}" unless clean.match?(/^[A-Za-z]/) clean = clean.gsub(Regexp.new("-#{tld}$"), '') clean.gsub(/(-+)/, '-') end
qualify(zone)
click to toggle source
# File lib/zt/importers/_base_importer.rb, line 38 def qualify(zone) zt_conf = Zt::Conf.instance.conf.zt "#{dnsify(zone)}.#{zt_conf['top_level_domain']}" end