Class: WSS4R::Config::Store
- Inherits:
-
Object
- Object
- WSS4R::Config::Store
- Defined in:
- lib/wss4r/config/config.rb
Instance Method Summary collapse
-
#initialize(file = ".\\wss4r-conf.yaml") ⇒ Store
constructor
A new instance of Store.
- #load ⇒ Object
- #save(config) ⇒ Object
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
#load ⇒ Object
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 |