Class: Vorpal::LookupByFk

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(config, fk_info, fk_values) ⇒ LookupByFk

Returns a new instance of LookupByFk.



132
133
134
135
136
# File 'lib/vorpal/db_loader.rb', line 132

def initialize(config, fk_info, fk_values)
  @config = config
  @fk_info = fk_info
  @fk_values = fk_values
end

Instance Attribute Details

#configObject (readonly)

Returns the value of attribute config.



131
132
133
# File 'lib/vorpal/db_loader.rb', line 131

def config
  @config
end

Instance Method Details

#load_all(db_driver) ⇒ Object



138
139
140
141
# File 'lib/vorpal/db_loader.rb', line 138

def load_all(db_driver)
  return [] if @fk_values.empty?
  db_driver.load_by_foreign_key(@config.db_class, @fk_values, @fk_info)
end