Skip to content
A MagLev indexer for the persistent root
Ruby
Branch: master
Clone or download

Latest commit

Fetching latest commit…
Cannot retrieve the latest commit at this time.

Files

Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
lib
spec
.gitignore
.rbenv-version
Gemfile
LICENSE
README.md
Rakefile
magdex.gemspec
rc

README.md

magdex

A MagLev indexer for the persistent root

Usage

Users = Magdex.store_for(:users)
class User
  attr_accessor :id, :name

  def initialize(name)
    @name = name
  end
end

bob = User.new('Bob')
Users.store(bob) # => true

...

bob2 = Users.find(1)
bob2.name # => "Bob"
bob == bob2 # => true

Users.index_by(:name, String) # => true

bob3 = Users.find_by(:name => 'Bob').first
bob3.name # => "Bob"
bob3 == bob2 # => true

Users.index_by(:name, :unique => true) # => false
Users.remove_index(:name) # => true
Users.index_by(:name, :unique => true) # => true

bob4 = Users.find_by(:name => 'Bob')
bob4.name # => "Bob"
bob4 == bob3 # => true
You can’t perform that action at this time.