Sha256: ff574d1d6e9a22924d4525696b4a1d81239ceb3106900d8e847109883c48f489
Contents?: true
Size: 762 Bytes
Versions: 15
Compression:
Stored size: 762 Bytes
Contents
require 'singleton' require 'singleton' require 'json' require 'singleton' require 'json' class ProjectSettingsManager include Singleton attr_accessor :root, :project_root def value(key, platform) settings.dig(platform.to_s, key) end def add(key, value, platform) json = settings json[platform.to_s] ||= {} json[platform.to_s][key] = value save(json) end private def settings path = FilePath.project_settings FileManager.create_file_if_not_exist(path) JSON.parse(File.read(path)) rescue JSON::ParserError => e {} end def save(json) path = FilePath.project_settings File.write(path, JSON.pretty_generate(json)) end end
Version data entries
15 entries across 15 versions & 1 rubygems