MemModel

MemModel persists Ruby objects using MagLev as a data storage engine. It is an ActiveModel compliant implementation so it works stand-alone or in Rails 3 as a drop-in replacement for ActiveRecord or DataMapper.

If MemModel is used in non-MagLev platforms, objects will be persisted to in-memory sets.

Installation

Run gem install mem_model to install the gem on its own.

Or you can add the following to your Gemfile and run the bundle command to install it.

gem 'mem_model'
Development

If you’d like to work on this project first make sure you have the hoe gem installed (gem install hoe if not), then run rake newb from the mem_model project directory.

Example

require 'mem_model'

class Account
  include MemModel::Base
  attr_accessor :balance
  validates_presence_of :balance
end

checking = Account.new  #=> #<Account balance: nil, id: 17338520>
checking.valid?         #=> false
checking.balance = 100  #=> 100
checking.valid?         #=> true

checking.save           #=> 17338520
checking.new?           #=> false
Account.size            #=> 1
Account.first           #=> #<Account balance: 100, id: 17338520>

Similar stuff

This stuff has been very helpful in working on MemModel.

Projects
Docs
Examples

Contributing

If you’d like to contribute to MemModel, that’s awesome. There’s a guide to contributing (both code and general help) over in CONTRIBUTING.md

Development

To see what has changed in recent versions, see the CHANGELOG.md.