boost::multi_index のようなものはありますが、ルビー用です。基本的に、オブジェクトのコンテナをいくつか取り、N 個の異なるクエリ メソッドを使用して N 個の異なる方法でインデックスを作成します。
SQLite in memory データベースで DataMapper を使用できると思いますが、純粋な Ruby が周りにあるかどうか疑問に思っていました。
以下は、このタイプのクラスが何をするかの想像上の例です。これは、データベースに非常によく似ています。
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 )