Rejuicer
Description
Rejuicer is easy search engine.
How to
Initialize and index target set
index = Rejuicer.new(:odd_flag, :remainder_3, :remainder_5)
Indexing
work = Struct.new(:id, :odd_flag, :remainder_3, :remainder_5)
mother = (0...10000).inject([]){|m, i| m << work.new(i, i % 2 == 0, i % 3, i % 5)}
index.set(mother)
Add to Index
num = 20000
inst = work.new(num, num % 2 == 0, num % 3, num % 5)
index.add(inst)
Remove from Index
index.delete(inst)
Search
index.search(:odd_flag => false) #=> [1,3,5,7,9...,9997,9999]
index.search(:remainder_3 => 2, :remainder_5 => 4) #=> [14,29,44,59,...,9974,9989]
INSTALL:
sudo gem install rejuicer
LICENSE:
Rejuicer is released under the MIT license.