Class: Quby::TableBackend::RangeTree

Inherits:
Object
  • Object
show all
Defined in:
lib/quby/table_backend/range_tree.rb

Instance Method Summary collapse

Constructor Details

#initialize(levels:, tree:) ⇒ RangeTree

Returns a new instance of RangeTree.

Parameters:

  • tree (Hash<>)

    hash of hashes leading from parameter values/ranges to a result.



32
33
34
35
# File 'lib/quby/table_backend/range_tree.rb', line 32

def initialize(levels:, tree:)
  @levels = levels
  @tree = tree
end

Instance Method Details

#lookup(parameters) ⇒ Object

Given a parameters hash that contains a value or range for every level in the tree, find and return the normscore. ie. ‘lookup(10, raw: 5, scale: ’Inhibitie’, gender: ‘male’)‘ => 39



40
41
42
43
# File 'lib/quby/table_backend/range_tree.rb', line 40

def lookup(parameters)
  validate_parameters(parameters)
  lookup_score(parameters)
end