Class: WSS4R::Config::Store

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

Instance Method Summary collapse

Constructor Details

#initialize(file = ".\\wss4r-conf.yaml") ⇒ Store

Returns a new instance of Store.



66
67
68
# File 'lib/wss4r/config/config.rb', line 66

def initialize(file=".\\wss4r-conf.yaml")
   @file = file
end

Instance Method Details

#loadObject



76
77
78
79
80
81
82
83
84
# File 'lib/wss4r/config/config.rb', line 76

def load()
   begin
      file = File.open(@file)
      config = YAML::load(file.read())
   rescue Exception
      return nil
   end
   config
end

#save(config) ⇒ Object



70
71
72
73
74
# File 'lib/wss4r/config/config.rb', line 70

def save(config)
   file = File.new(@file,"w")
   YAML::dump(config, file)
   file.close()
end