Sha256: bb965b4463807293b3d74666eca90a60f40fce3ba33ae5e36cb7816d57d4b941
Contents?: true
Size: 807 Bytes
Versions: 1
Compression:
Stored size: 807 Bytes
Contents
# encoding: utf-8 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
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
grumblr-2.4.2 | lib/grumblr/config.rb |