Module: Quby::TableBackend

Defined in:
lib/quby/table_backend/range_tree.rb

Overview

A lookup tree to find values by multiple arguments.

Example tree: Inhibitie:

male:
  10...11:
    -Infinity...10: 39
    10...20: 42
  11...12:
    -Infinity...10: 40
    10...20: : 43
female:
  10...11: 38
  ...

with levels:

‘scale’, ‘gender’, ‘age’, ‘raw’, ‘norm’

will allow a lookup like: lookup(10, raw: 5, scale: ‘Inhibitie’, gender: ‘male’)‘ => 39

Keys in the tree will be matched by hash lookup of the parameter value with the following exeptions: floats: can be found by integer as well strings: can be found by symbol as well. enumerables: will find the first key for which ‘include?(param)` returns true.

Defined Under Namespace

Classes: RangeTree