Sha256: 5562b3fcc860c438e140700502faf6ba844313784e5abaa3c45f56789869d1eb

Contents?: true

Size: 580 Bytes

Versions: 8

Compression:

Stored size: 580 Bytes

Contents

# frozen_string_literal: true

require 'quby/table_backend/range_tree'

module Quby
  class LookupTable
    attr_accessor :key

    def initialize(key)
      @key = key
    end

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

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

    def data
      Quby.lookup_table_repo.retrieve(key)
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
quby-4.0.4 lib/quby/lookup_table.rb
quby-5.0.0.pre2 lib/quby/lookup_table.rb
quby-5.0.0.pre1 lib/quby/lookup_table.rb
quby-4.0.3 lib/quby/lookup_table.rb
quby-4.0.2 lib/quby/lookup_table.rb
quby-4.0.1 lib/quby/lookup_table.rb
quby-4.0.0 lib/quby/lookup_table.rb
quby-3.2.2 lib/quby/lookup_table.rb