Active PStore

This library has Active Record like interface. Use pstore to store data.
FEATURES/PROBLEMS
- Oh so many problems...
- Transaction NOT supported (caused by implementation)
- Data Migration NOT supported
- Performance (caused by implementation)
- and Not solving the root cause for enterprise...
SYNOPSIS
class definition and instantiate
require 'active_pstore'
class Artist < ActivePStore::Base
def initialize(name)
@name = name
end
attr_reader :name
end
randy_rhoads = Artist.new('Randy Rhoads')
specify data store path
Artist.establish_connection(database: '/path/to/file')
save
randy_rhoads.save
database key is string of class name.
Artist.table_name # => 'Artist'
ex) Fetch stored artist objects by pure PStore.
database = PStore.new('/path/to/file')
database.transaction {|db| artist = db['Artist'] } # fetch instances of Artist class.
allocate value of ActivePStore::Base#id using SecureRandom.hex.
> randy_rhoads.id # => nil
> randy_rhoads.save
> randy_rhoads.id # => "0b84ece5d5be3bce3ee2101c1c4f6fda"
find series
Artist.all
Artist.first
Artist.last
Artist.find('388980778246cbcbfcbb7a8292f28c37') # ActivePStore::Base#id is an SecureRandom.hex value
Artist.where(name: 'Randy Rhoads')
Range
Artist.where(birth_date: Date.new(1948, 12, 3)..Date.new(1956, 12, 6))
see spec codes for more information.
REQUIREMENTS
no requirements
INSTALL
Add these lines to your application's Gemfile:
gem 'active_pstore'
And then execute:
$ bundle
Or install it yourself as:
$ gem install active_pstore
And require it as:
require 'active_pstore'
Presentation Document
- The making of a story (Japanese text) ... http://www.slideshare.net/koic/software-development-and-rubygems
LICENCE
The MIT Licence
Contributing
- 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