Module: SecureConf::Storage::Yaml

Defined in:
lib/secure_conf/storage/yaml.rb

Class Method Summary collapse

Class Method Details

.load(path) ⇒ Object



6
7
8
9
10
11
12
# File 'lib/secure_conf/storage/yaml.rb', line 6

def self.load(path)
  if File.file?(path)
    YAML.load_file(path)
  else
    {}
  end
end

.save(path, obj) ⇒ Object



14
15
16
17
18
# File 'lib/secure_conf/storage/yaml.rb', line 14

def self.save(path, obj)
  h = {}
  h.replace(obj)
  YAML.dump(h, File.open(path, "w"))
end