Sha256: be9eed9e635cf63318d95d1c856cec33f6c09d280dcf53c02b089dc63b4c3099
Contents?: true
Size: 532 Bytes
Versions: 35
Compression:
Stored size: 532 Bytes
Contents
require "json" module PodPrebuild class JSONFile attr_reader :path attr_reader :data def initialize(path) @path = path @data = load_json end def empty? @data.empty? end def [](key) @data[key] end def []=(key, value) @data[key] = value end def save! File.open(@path, "w") { |f| f.write(JSON.pretty_generate(@data)) } end private def load_json File.open(@path) { |f| JSON.parse(f.read) } rescue {} end end end
Version data entries
35 entries across 35 versions & 4 rubygems