Module: SecureConf::Storage::Yaml

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

Class Method Summary collapse

Class Method Details

.load(path) ⇒ Object



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

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

.save(path, obj) ⇒ Object



19
20
21
22
23
# File 'lib/secure_conf/storage/yaml.rb', line 19

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