Class: Zt::Conf
Overview
Create initial config if it is not present already
Instance Attribute Summary collapse
-
#conf ⇒ Object
Returns the value of attribute conf.
Instance Method Summary collapse
-
#initialize ⇒ Conf
constructor
A new instance of Conf.
- #save!(*sections) ⇒ Object
Constructor Details
#initialize ⇒ Conf
Returns a new instance of Conf.
15 16 17 18 |
# File 'lib/zt/conf.rb', line 15 def initialize raise Errors::ZtConfDiskError unless ensure_config_on_disk raise Errors::ZtConfSyntaxError unless read_config end |
Instance Attribute Details
#conf ⇒ Object
Returns the value of attribute conf.
13 14 15 |
# File 'lib/zt/conf.rb', line 13 def conf @conf end |
Instance Method Details
#save!(*sections) ⇒ Object
20 21 22 23 24 25 26 27 |
# File 'lib/zt/conf.rb', line 20 def save!(*sections) sections = %i[domains networks nodes zt] if sections.empty? sections.each do |section| File.open(full_path_for_section(section), 'w') do |f| YAML.dump(@conf[section], f) end end end |