class Sticky::Config
Public Class Methods
new()
click to toggle source
# File lib/sticky/config.rb, line 4 def initialize @config = { store: "YAML::Store", sticky_path: File.join(Dir.home, ".sticky.yml") }.merge(config_overrides) end
Public Instance Methods
fetch(key)
click to toggle source
# File lib/sticky/config.rb, line 11 def fetch(key) @config[key] end
Private Instance Methods
config_file()
click to toggle source
# File lib/sticky/config.rb, line 25 def config_file File.exists?(config_path) ? File.open(config_path) : "{}" end
config_overrides()
click to toggle source
# File lib/sticky/config.rb, line 17 def config_overrides YAML.load(config_file).tap do |yaml| yaml.keys.each do |key| yaml[key.to_sym] = yaml.delete(key) end end end
config_path()
click to toggle source
# File lib/sticky/config.rb, line 29 def config_path File.join(Dir.home, ".sticky.config") end