Module: Rolltools::Settings

Defined in:
lib/rolltools/settings.rb

Class Method Summary collapse

Class Method Details

.get(key) ⇒ Object



21
22
23
# File 'lib/rolltools/settings.rb', line 21

def self.get(key)
  settings[key]
end

.set(key, value) ⇒ Object



14
15
16
17
18
19
# File 'lib/rolltools/settings.rb', line 14

def self.set(key, value)
  settings[key] = value
  File.open("#{Dir.home}/.rolltools.yml", "w") do |file|
    file.write settings.to_yaml
  end
end

.settingsObject



9
10
11
12
# File 'lib/rolltools/settings.rb', line 9

def self.settings
  @@settings ||= YAML::load_file "#{Dir.home}/.rolltools.yml" rescue nil
  @@settings ||= {}
end

.settings=(settings) ⇒ Object



5
6
7
# File 'lib/rolltools/settings.rb', line 5

def self.settings=(settings)
  @@settings = settings
end