Sha256: 9940e7057829908b01de3e89dbe84a6dc5fa6288f156c62e10bad5f4720676ae
Contents?: true
Size: 757 Bytes
Versions: 6
Compression:
Stored size: 757 Bytes
Contents
require "yaml" require "singleton" module GetToWork class ConfigFile attr_reader :data include Singleton def initialize setup_data(self.class.path) end def setup_data(path) @data = begin YAML.load_file(path) rescue Errno::ENOENT {} end end def [](key) @data[key] end def []=(key, value) @data[key] = value end def self.save instance.save end def save File.open(self.class.path, "w") { |f| f.write YAML.dump(@data) } end def self.exist? File.exist? path end def self.path File.join(Dir.pwd, filename) end def self.filename ".get-to-work" end end end
Version data entries
6 entries across 6 versions & 1 rubygems