Class: Vorpal::LookupInstructions

Inherits:
Object
  • Object
show all
Defined in:
lib/vorpal/db_loader.rb

Instance Method Summary collapse

Constructor Details

#initializeLookupInstructions

Returns a new instance of LookupInstructions.



75
76
77
78
# File 'lib/vorpal/db_loader.rb', line 75

def initialize
  @lookup_by_id = Util::ArrayHash.new
  @lookup_by_fk = Util::ArrayHash.new
end

Instance Method Details

#empty?Boolean

Returns:

  • (Boolean)


96
97
98
# 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) ⇒ Object



84
85
86
# 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) ⇒ Object



80
81
82
# 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_lookupObject



88
89
90
91
92
93
94
# 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