Class: RecordLoader::TubeRackPurposeLoader
- Inherits:
-
ApplicationRecordLoader
- Object
- Base
- ApplicationRecordLoader
- RecordLoader::TubeRackPurposeLoader
- Defined in:
- lib/record_loader/tube_rack_purpose_loader.rb
Overview
Creates the specified tube rack purposes if they are not present
Constant Summary collapse
- DEFAULT_PRINTER_TYPE =
'96 Well Plate'
- DEFAULT_TARGET_TYPE =
'TubeRack'
Instance Method Summary collapse
Methods inherited from ApplicationRecordLoader
Instance Method Details
#barcode_printer_type(name) ⇒ Object
21 22 23 24 25 26 27 |
# File 'lib/record_loader/tube_rack_purpose_loader.rb', line 21 def (name) @printer_cache ||= Hash.new do |hash, uncached_type_name| hash[uncached_type_name] = BarcodePrinterType.find_by(name: uncached_type_name) end @printer_cache[name || DEFAULT_PRINTER_TYPE] end |
#create_or_update!(name, options) ⇒ Object
15 16 17 18 19 |
# File 'lib/record_loader/tube_rack_purpose_loader.rb', line 15 def create_or_update!(name, ) ['target_type'] = DEFAULT_TARGET_TYPE ['barcode_printer_type'] = (['barcode_printer_type']) TubeRack::Purpose.create_with().find_or_create_by!(name:) end |