This gem allows easy creation of in-memory hashes and persists them into a pstore file.
Add this line to your application's Gemfile:
gem 'ztore'
And then execute:
$ bundle
Or install it yourself as:
$ gem install ztore
Use case 1: initial data creation
require 'ztore'
db = Ztore::DB.new(:db) # => will create file 'db.pstore'
db.tree :People # this will derive a class 'People' from Ztore::Tree, usable as a Hash
People[0] = 'CM'
p People[0]
People[1] = { :name => 'CM', :features => { :developer => true } }
p People[1]
db.save # this is needed at the end of your script to store
Use case 2: use a previously created Ztore::DB
require 'ztore'
db = Ztore::DB.new(:db) # => will load file 'db.pstore' and recreate all Ztore::Tree
p People[0] # 'CM'
p People[1] # { :name => 'CM', :features => { :developer => true } }
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request