Skip to content

johnnyt/mem_model

Repository files navigation

MemModel Ver Bld Cov

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
  • Tesla: MagLev niceties like models... and signs
  • Supermodel. Simple in-memory database using ActiveModel. Primarily developed for Bowline applications.
  • ActiveAttr: What ActiveModel left out
  • MagLevRecord: MagLev persistence with an ActiveRecord-like interface!
Docs
Examples
  • Blog Data Migration Example: create a blog, add attributes, migrate existing instances
  • K-d Tree: includes a Google Maps example using zipcodes
  • Indexing: use unordered collections with MagLev's built-in indexing support
  • Points: shows two approaches of handling data migration using a Point class.

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.

About

ActiveModel compliant MagLev persistence

Resources

License

Contributing

Stars

Watchers

Forks

Packages

No packages published

Languages