Module: Watobo::Gui::Settings

Defined in:
lib/watobo/gui/mixins/gui_settings.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.save_gui_settings(settings) ⇒ Object



26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/watobo/gui/mixins/gui_settings.rb', line 26

def self.save_gui_settings(settings)
  wd = Watobo.working_directory

  dir_name = Watobo::Utils.snakecase self.class.to_s.gsub(/.*::/,'')
  path = File.join(wd, "conf", "gui")
  Dir.mkdir path unless File.exist? path
  conf_dir = File.join(path, dir_name)
  Dir.mkdir conf_dir unless File.exist? conf_dir
  file = File.join(conf_dir, dir_name + "_settings.yml")
  
  Watobo::Utils.save_settings(file, config)
end

Instance Method Details

#load_gui_settingsObject



39
40
41
42
43
44
45
46
47
48
49
# File 'lib/watobo/gui/mixins/gui_settings.rb', line 39

def load_gui_settings()
  wd = Watobo.working_directory
  dir_name = Watobo::Utils.snakecase self.class.to_s.gsub(/.*::/,'')
  path = File.join(wd, "conf", "gui")
  Dir.mkdir path unless File.exist? path
  conf_dir = File.join(path, dir_name)
  Dir.mkdir conf_dir unless File.exist? conf_dir
  file = File.join(conf_dir, dir_name + "_settings.yml")
  config = Watobo::Utils.load_settings(file)
  config
end