Is there anything like boost::multi_index but for ruby. Basically taking some container of objects and having it indexed N different ways with N different query methods.
I guess you could use DataMapper with the SQLite in memory database but I was wondering if there is anything pure ruby around.
Below is an imagined example of what this type of class might do. It looks very much like a database.
class Foo
attr_accessor :a
attr_accessor :b
attr_accessor :c
end
class FooIndexer < MultiIndex
hash_index :a do |o|
o.a
end
ordered_index :b do |x, y|
x.b <=> y.b
end
end
index = FooIndexer.new
index.insert( Foo.new ( ... ))
index.insert( Foo.new ( ... ))
index.insert( Foo.new ( ... ))
index.insert( Foo.new ( ... ))
index.insert( Foo.new ( ... ))
index.find ( index.a == 10 )
index.find ( index.b > 10 )