# PermaStore
- class PermaStore < Hash
- def self.load
- if File.exists?( "data.dump" )
- File.open( "data.dump", "r" ) do |f|
- return Marshal.load( f )
- end
- end
- return PermaStore.new
- end
- def []=( key, value )
- super
- save
- end
- def delete( value )
- super
- save
- end
- protected
- def save
- File.open( "data.dump", "w" ) do |f|
- Marshal.dump( self, f )
- end
- end
- end
Do whatever you will with it. It’s not thread safe, but that’s easily fixable if you’re so inclined.