class Dropbox::Archive::Configuration
Attributes
config_cache[RW]
config_path[RW]
Public Class Methods
new(config_path)
click to toggle source
# File lib/dropbox/archive/configuration.rb, line 7 def initialize(config_path) @config_path = config_path end
Public Instance Methods
get(key)
click to toggle source
# File lib/dropbox/archive/configuration.rb, line 11 def get(key) load config_cache[key] end
set(key, value)
click to toggle source
# File lib/dropbox/archive/configuration.rb, line 16 def set(key, value) load config_cache[key] = value save value end
Private Instance Methods
load()
click to toggle source
# File lib/dropbox/archive/configuration.rb, line 25 def load if !File.exists?(File.expand_path(config_path)) FileUtils.touch(File.expand_path(config_path)) end self.config_cache = YAML.load_file(File.expand_path(config_path)) || {} end
save()
click to toggle source
# File lib/dropbox/archive/configuration.rb, line 33 def save load unless config_cache File.open(File.expand_path(config_path), 'wb') do |f| f.write config_cache.to_yaml end end