Class: RUGS::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/rugs/config.rb

Constant Summary collapse

PATH =
build_path("~/.rugs", "config")

Class Method Summary collapse

Class Method Details

.load(name) ⇒ Object



8
9
10
11
# File 'lib/rugs/config.rb', line 8

def self.load(name)
  return {} unless File.exist?(config_file(name))
  Psych.load(File.open(config_file(name)))
end

.save(name, hash) ⇒ Object



13
14
15
16
17
# File 'lib/rugs/config.rb', line 13

def self.save(name, hash)
  File.open(config_file(name), "w") do |file|
    file.write(hash.to_yaml)
  end
end