Sha256: 3667297643497888599fd5d03d9267d649ec8af2c6fdc233b320f624590cd308
Contents?: true
Size: 861 Bytes
Versions: 1
Compression:
Stored size: 861 Bytes
Contents
module Flucti module Parameters extend self extend Utilities def store_dir @store_dir ||= begin options = [] options << Pathname(ENV['APPDATA']) / 'Flucti' if ENV['APPDATA'] options << Pathname(ENV['HOME']) / '.flucti' if ENV['HOME'] located = options.find { |dir| dir.directory? } || options.find { |dir| dir.dirname.directory? } located ||= Pathname(Dir.tmpdir) / 'flucti' located.mkpath located end end def data_store @data_store ||= store_dir / 'parameters.yml' end def fetch(key) cache[key.to_s] end def store(key, value) cache[key.to_s] = value data_store.open("w") { |f| f << YAML.dump(cache) } end private def cache @cache ||= (YAML.load_file(data_store) if data_store.exist?) || {} end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
Flucti-flucti-cli-0.1.16 | lib/flucti/parameters.rb |