Sha256: 843950f317c229630e33a6f728ab046712b38460516084c01467a29aaa230b65
Contents?: true
Size: 640 Bytes
Versions: 12
Compression:
Stored size: 640 Bytes
Contents
require 'yaml' require 'fileutils' require 'supermodel' # A simple means of persistence # This can easily be swapped out for redis, but file-based is simpler and good enough for now # https://github.com/maccman/supermodel/blob/master/README module Memory extend self DATABASE_PATH = (ENV['DATABASE_PATH'] || File.expand_path('../data/memory.db', $PROGRAM_NAME)).freeze SuperModel::Marshal.path = DATABASE_PATH def save FileUtils.mkdir_p(File.dirname(DATABASE_PATH)) # FIXME: - don't make if it already exists SuperModel::Marshal.dump end def load SuperModel::Marshal.load end end at_exit do Memory.save end
Version data entries
12 entries across 12 versions & 1 rubygems