Class: VagrantDNS::TldRegistry

Inherits:
Object
  • Object
show all
Includes:
Store
Defined in:
lib/vagrant-dns/tld_registry.rb

Overview

This is the dns pattern registry (aka “config”) It basically delegates everything to a YAML::Store but handles the conversion of Regexp dns-patterns into YAML string keys and reverse.

Constant Summary collapse

NAME =
"ltds"

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Store

included

Constructor Details

#initialize(tmp_path) ⇒ TldRegistry

Returns a new instance of TldRegistry.



10
11
12
# File 'lib/vagrant-dns/tld_registry.rb', line 10

def initialize(tmp_path)
  @store = YAML::Store.new(File.join(tmp_path, NAME), true)
end

Class Method Details

.open(tmp_path) ⇒ VagrantDNS::Registry?

Returns Eitehr an instance or nil if cofig file does not exist.

Returns:



15
16
17
# File 'lib/vagrant-dns/tld_registry.rb', line 15

def self.open(tmp_path)
  new(tmp_path) if File.exist?(File.join(tmp_path, NAME))
end