Sha256: d8eee2c6d547722e30b36e8cfaa71208ea5ee9e1bf04f3adb963bef5a0fc610f
Contents?: true
Size: 788 Bytes
Versions: 2
Compression:
Stored size: 788 Bytes
Contents
require 'yaml' module Grumblr class Config def initialize prepare_directory end def conf @@conf ||= YAML::load(open(config_file)) rescue @@conf ||= {} end def get(name) conf[name.to_s] end def set(name, value) conf[name.to_s] = value end def save File.open(config_file, 'w') { |f| f.write conf.to_yaml } end def destroy @@conf = {} $app.quit end def config_file File.join(config_directory, 'settings.yml') end def config_directory @config_directory ||= File.expand_path(File.join('~', '.config', 'grumblr')) end def prepare_directory return if File.directory?(config_directory) FileUtils.mkdir_p(config_directory) end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
grumblr-2.4.1 | lib/grumblr/config.rb |
grumblr-2.4.0 | lib/grumblr/config.rb |