Class: QcableCreator
- Inherits:
-
ApplicationRecord
- Object
- ActiveRecord::Base
- ApplicationRecord
- QcableCreator
- Includes:
- Uuid::Uuidable
- Defined in:
- app/models/qcable_creator.rb
Instance Attribute Summary collapse
-
#barcodes ⇒ Object
Returns the value of attribute barcodes.
-
#count ⇒ Object
Returns the value of attribute count.
-
#supplied_barcode ⇒ Object
Returns the value of attribute supplied_barcode.
Instance Method Summary collapse
- #make_qcables! ⇒ Object
- #qcables_by_barcode! ⇒ Object
- #qcables_by_count! ⇒ Object
-
#qcables_by_supplied_barcode! ⇒ Object
Creates using the supplied plate barcode we received from baracoda.
Methods included from Uuid::Uuidable
included, #unsaved_uuid!, #uuid
Methods inherited from ApplicationRecord
alias_association, convert_labware_to_receptacle_for, find_by_id_or_name, find_by_id_or_name!
Methods included from Squishify
Instance Attribute Details
#barcodes ⇒ Object
Returns the value of attribute barcodes.
12 13 14 |
# File 'app/models/qcable_creator.rb', line 12 def @barcodes end |
#count ⇒ Object
Returns the value of attribute count.
12 13 14 |
# File 'app/models/qcable_creator.rb', line 12 def count @count end |
#supplied_barcode ⇒ Object
Returns the value of attribute supplied_barcode.
12 13 14 |
# File 'app/models/qcable_creator.rb', line 12 def @supplied_barcode end |
Instance Method Details
#make_qcables! ⇒ Object
16 17 18 19 20 |
# File 'app/models/qcable_creator.rb', line 16 def make_qcables! return if .present? qcables_by_count! if count.present? if .present? end |
#qcables_by_barcode! ⇒ Object
26 27 28 |
# File 'app/models/qcable_creator.rb', line 26 def .split(',').collect { || lot.qcables.create!(qcable_creator: self, barcode: ) } end |
#qcables_by_count! ⇒ Object
22 23 24 |
# File 'app/models/qcable_creator.rb', line 22 def qcables_by_count! lot.qcables.build([{ qcable_creator: self }] * count).tap { |_| lot.save! } end |
#qcables_by_supplied_barcode! ⇒ Object
Creates using the supplied plate barcode we received from baracoda
31 32 33 |
# File 'app/models/qcable_creator.rb', line 31 def lot.qcables.create!(qcable_creator: self, supplied_barcode: ) end |