class Vorpal::LookupInstructions

@private

Public Class Methods

new() click to toggle source
# File lib/vorpal/db_loader.rb, line 75
def initialize
  @lookup_by_id = Util::ArrayHash.new
  @lookup_by_fk = Util::ArrayHash.new
end

Public Instance Methods

empty?() click to toggle source
# File lib/vorpal/db_loader.rb, line 96
def empty?
  @lookup_by_id.empty? && @lookup_by_fk.empty?
end
lookup_by_fk(config, fk_info, fk_value) click to toggle source
# File lib/vorpal/db_loader.rb, line 84
def lookup_by_fk(config, fk_info, fk_value)
  @lookup_by_fk.append([config, fk_info], fk_value)
end
lookup_by_unique_key(config, column_name, values) click to toggle source
# File lib/vorpal/db_loader.rb, line 80
def lookup_by_unique_key(config, column_name, values)
  @lookup_by_id.append([config, column_name], values)
end
next_lookup() click to toggle source
# File lib/vorpal/db_loader.rb, line 88
def next_lookup
  if @lookup_by_id.empty?
    pop_fk_lookup
  else
    pop_id_lookup
  end
end

Private Instance Methods

pop_fk_lookup() click to toggle source
# File lib/vorpal/db_loader.rb, line 109
def pop_fk_lookup
  key, fk_values = @lookup_by_fk.pop
  config = key.first
  fk_info = key.last
  LookupByFk.new(config, fk_info, fk_values)
end
pop_id_lookup() click to toggle source
# File lib/vorpal/db_loader.rb, line 102
def pop_id_lookup
  key, ids = @lookup_by_id.pop
  config = key.first
  column_name = key.last
  LookupById.new(config, column_name, ids)
end