Class: Quby::LookupTable

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(key) ⇒ LookupTable

Returns a new instance of LookupTable.



9
10
11
# File 'lib/quby/lookup_table.rb', line 9

def initialize(key)
  @key = key
end

Instance Attribute Details

#keyObject

Returns the value of attribute key.



7
8
9
# File 'lib/quby/lookup_table.rb', line 7

def key
  @key
end

Instance Method Details

#backingObject



13
14
15
16
17
18
19
# File 'lib/quby/lookup_table.rb', line 13

def backing
  return @backing if @backing.present?
  all_data = data
  headers = all_data.shift
  compare = all_data.shift
  @backing = Quby::TableBackend::RangeTree.new(headers, compare, all_data)
end

#dataObject



25
26
27
# File 'lib/quby/lookup_table.rb', line 25

def data
  Quby.lookup_table_repo.retrieve(key)
end

#lookup(parameters) ⇒ Object



21
22
23
# File 'lib/quby/lookup_table.rb', line 21

def lookup(parameters)
  backing.lookup(parameters)
end