Class: MemDB::Index::PrefixTree
- Inherits:
-
Object
- Object
- MemDB::Index::PrefixTree
- Includes:
- MemDB::Index
- Defined in:
- lib/mem_db/index/prefix_tree.rb
Defined Under Namespace
Instance Attribute Summary collapse
-
#bucket ⇒ Object
readonly
Returns the value of attribute bucket.
-
#idx ⇒ Object
readonly
Returns the value of attribute idx.
Instance Method Summary collapse
- #add(obj, value) ⇒ Object
-
#initialize(idx:, bucket: MemDB::Bucket) ⇒ PrefixTree
constructor
A new instance of PrefixTree.
- #query(query, out: MemDB::Out.new) ⇒ Object
Methods included from MemDB::Index
Constructor Details
#initialize(idx:, bucket: MemDB::Bucket) ⇒ PrefixTree
Returns a new instance of PrefixTree.
93 94 95 96 97 |
# File 'lib/mem_db/index/prefix_tree.rb', line 93 def initialize(idx:, bucket: MemDB::Bucket) @idx = idx @bucket = bucket @root = Root.new(bucket: bucket) end |
Instance Attribute Details
#bucket ⇒ Object (readonly)
Returns the value of attribute bucket.
91 92 93 |
# File 'lib/mem_db/index/prefix_tree.rb', line 91 def bucket @bucket end |
#idx ⇒ Object (readonly)
Returns the value of attribute idx.
91 92 93 |
# File 'lib/mem_db/index/prefix_tree.rb', line 91 def idx @idx end |
Instance Method Details
#add(obj, value) ⇒ Object
99 100 101 |
# File 'lib/mem_db/index/prefix_tree.rb', line 99 def add(obj, value) @root.add(obj.idx_value(@idx), obj, value) end |