Sha256: d0860799ec9d2ba6371d3f3094688f3569f8ad0e04a54b82a1a1da526df36306
Contents?: true
Size: 633 Bytes
Versions: 5
Compression:
Stored size: 633 Bytes
Contents
# -*- encoding : utf-8 -*- require 'json' class Phrase::Tool::Config def initialize if File.exist?(".phrase") begin contents = File.read(".phrase") @config = JSON.parse(contents) rescue JSON::ParserError => err $stderr.puts "Could not parse config file: #{err}" end end end def secret config["secret"] end def secret=(new_secret) config["secret"] = new_secret save_config! end private def config @config ||= {} end def save_config! File.open(".phrase", "w+") do |file| file.write(JSON.pretty_generate(config)) end end end
Version data entries
5 entries across 5 versions & 1 rubygems