Module: Quby::TableBackend

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

Overview

Create a value lookup tree from a headers array, a compare (type) array and a data array of arrays. The #lookup method will try to find the data row where each of the comparison columns matches the given parameters and return the value from the norm column.

#initialize params: headers: An array of column names compare: An array of lookup types (string, float or range) for each column data: An array of arrays containing the rows describing the mapping from the

different lookup columns to the `norm` value.

The last column of the headers must be called ‘norm’ and must have the ‘float’ type (in compare array).

String and float types are used to make an exact match. A range is always a range between two floats where the range is between the low value (inclusive) and the high value (exclusive), written as 4:5 (low:high). These boundaries can be given as floats or integers, but internally they are always treated as a floats. The low and high values of a range cannot be equal. Use minfinity or infinity to create infinite ranges.

Defined Under Namespace

Classes: RangeTree