class ConfigStore
Constants
- CONFIG_FILE
Public Class Methods
new()
click to toggle source
# File lib/localio/config_store.rb, line 4 def initialize if File.exist? CONFIG_FILE @config = YAML.load_file(CONFIG_FILE) end @config ||= Hash.new end
Public Instance Methods
get(key)
click to toggle source
# File lib/localio/config_store.rb, line 15 def get(key) @config[clean_param key] end
has?(key)
click to toggle source
# File lib/localio/config_store.rb, line 11 def has?(key) @config.has_key?(clean_param key) end
persist()
click to toggle source
# File lib/localio/config_store.rb, line 23 def persist File.open(CONFIG_FILE, 'w') do |h| h.write @config.to_yaml end end
store(key, data)
click to toggle source
# File lib/localio/config_store.rb, line 19 def store(key, data) @config[clean_param key] = data end
Private Instance Methods
clean_param(param)
click to toggle source
# File lib/localio/config_store.rb, line 30 def clean_param(param) if param.is_a?(Symbol) param.to_s else param end end