Class: MemDB::Index::SequenceMatch
- Inherits:
-
Object
- Object
- MemDB::Index::SequenceMatch
- Includes:
- MemDB::Index
- Defined in:
- lib/mem_db/index/sequence_match.rb
Defined Under Namespace
Classes: Bucket, SequenceIndex
Instance Method Summary collapse
- #add(obj, value) ⇒ Object
-
#initialize(idx:, bucket: MemDB::Bucket) ⇒ SequenceMatch
constructor
A new instance of SequenceMatch.
- #query(query, out: MemDB::Out.new) ⇒ Object
Methods included from MemDB::Index
Constructor Details
#initialize(idx:, bucket: MemDB::Bucket) ⇒ SequenceMatch
Returns a new instance of SequenceMatch.
111 112 113 114 115 116 |
# File 'lib/mem_db/index/sequence_match.rb', line 111 def initialize(idx:, bucket: MemDB::Bucket) @idx = idx @bucket = bucket @patterns = {} @matchers = {} end |
Instance Method Details
#add(obj, value) ⇒ Object
118 119 120 121 122 123 124 125 |
# File 'lib/mem_db/index/sequence_match.rb', line 118 def add(obj, value) obj.idx_value(@idx).each do |pattern| @patterns[pattern] ||= @bucket.new @patterns[pattern].add(obj, value) @matchers[pattern] ||= SequenceIndex.new(pattern) end end |