Sha256: c86e37b382c387d1e6b7d9986808d21cedcfce4ddb60517429fb8392da6e35a0
Contents?: true
Size: 430 Bytes
Versions: 2
Compression:
Stored size: 430 Bytes
Contents
require 'json' module PkgForge ## # Add state methods to Forge class Forge Contract nil => Hash def state @state ||= {} end Contract String => nil def load_state!(statefile) @state = JSON.parse(File.read(statefile)) end Contract String => nil def write_state!(statefile) File.open(statefile, 'w') do |fh| fh << state.to_json end nil end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
pkgforge-0.13.2 | lib/pkgforge/components/state.rb |
pkgforge-0.13.1 | lib/pkgforge/components/state.rb |