Sha256: 6c9965feb2bd692e36277893391ba9152dea15ea57f851c9aed800810aae7d24
Contents?: true
Size: 733 Bytes
Versions: 1
Compression:
Stored size: 733 Bytes
Contents
require 'yaml' module MovieStone class Configurator include Singleton def config @config ||= load_config end def load_config @config_file = File.join(ENV['HOME'], '.movie_stone.rc.yml') if File.exist?(@config_file) @config = YAML.load_file(@config_file) else @config = {} write_config(@config) end @config = Class.new(Hash) do include Hashie::Extensions::IndifferentAccess include Hashie::Extensions::DeepMerge include Hashie::Extensions::MethodAccess end.new.deep_merge(@config) end def write_config(config) File.open(@config_file, 'w') do |f| f.write(YAML.dump(config)) end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
movie_stone-0.1.0 | lib/movie_stone/configurator.rb |