Module: Factbase::IndexedTerm
- Defined in:
- lib/factbase/indexed/indexed_term.rb
Overview
Term with an index.
- Author
-
Yegor Bugayenko ([email protected])
- Copyright
-
Copyright © 2024-2025 Yegor Bugayenko
- License
-
MIT
Instance Method Summary collapse
-
#predict(maps, fb, params) ⇒ Array<Hash>|nil
Reduces the provided list of facts (maps) to a smaller array, if it’s possible.
Instance Method Details
#predict(maps, fb, params) ⇒ Array<Hash>|nil
Reduces the provided list of facts (maps) to a smaller array, if it’s possible.
NIL must be returned if indexing is prohibited in this case.
32 33 34 35 36 37 38 39 40 41 |
# File 'lib/factbase/indexed/indexed_term.rb', line 32 def predict(maps, fb, params) if @terms.key?(@op) t = @terms[@op] return t.predict(maps, fb, params) if t.respond_to?(:predict) end m = :"#{@op}_predict" return send(m, maps, fb, params) if respond_to?(m) _init_indexes unless @indexes @indexes[@op].predict(maps, fb, params) if @indexes.key?(@op) end |