Class: Tube::Purpose
- Inherits:
-
Purpose
- Object
- ActiveRecord::Base
- ApplicationRecord
- Purpose
- Tube::Purpose
- Defined in:
- app/models/tube/purpose.rb
Overview
Base class for the all tube purposes, describes the role the associated Tube is playing within the lab, and my modify its behaviour. This is not an abstract class, and can be used directly.
Direct Known Subclasses
IlluminaHtp::MxTubePurpose, IlluminaHtp::StockTubePurpose, QcableTubePurpose, StandardMx, StockMx
Class Method Summary collapse
- .standard_library_tube ⇒ Object
- .standard_mx_tube ⇒ Object
- .standard_sample_tube ⇒ Object
- .stock_library_tube ⇒ Object
- .stock_mx_tube ⇒ Object
Instance Method Summary collapse
- #create!(*args, &block) ⇒ Object
- #library_source_plates(_) ⇒ Object
- #sibling_tubes(_tube) ⇒ Object
-
#stock_plate(_) ⇒ Object
Tubes of the general types have no stock plate!.
Methods inherited from Purpose
#barcode_type, #prefix=, #set_default_barcode_prefix, #source_plate, #source_plates, #source_purpose_name=, #target_class
Methods included from Uuid::Uuidable
included, #unsaved_uuid!, #uuid
Methods included from Purpose::Relationship::Associations
Methods inherited from ApplicationRecord
convert_labware_to_receptacle_for, find_by_id_or_name, find_by_id_or_name!
Methods included from Squishify
Methods included from Warren::BroadcastMessages
#broadcast, included, #queue_associated_for_broadcast, #queue_for_broadcast, #warren
Class Method Details
.standard_library_tube ⇒ Object
54 55 56 57 58 |
# File 'app/models/tube/purpose.rb', line 54 def standard_library_tube Tube::Purpose.create_with( target_type: 'LibraryTube' ).find_or_create_by!(name: 'Standard library') end |
.standard_mx_tube ⇒ Object
60 61 62 63 64 |
# File 'app/models/tube/purpose.rb', line 60 def standard_mx_tube Tube::StandardMx.create_with( target_type: 'MultiplexedLibraryTube' ).find_or_create_by!(name: 'Standard MX') end |
.standard_sample_tube ⇒ Object
48 49 50 51 52 |
# File 'app/models/tube/purpose.rb', line 48 def standard_sample_tube Tube::Purpose.create_with( target_type: 'SampleTube' ).find_or_create_by!(name: 'Standard sample') end |
Instance Method Details
#create!(*args, &block) ⇒ Object
23 24 25 26 27 28 |
# File 'app/models/tube/purpose.rb', line 23 def create!(*args, &block) = args. [:purpose] = self [:barcode_prefix] ||= target_class.(*args, , &block).tap { |t| tubes << t } end |
#library_source_plates(_) ⇒ Object
19 20 21 |
# File 'app/models/tube/purpose.rb', line 19 def library_source_plates(_) [] end |
#sibling_tubes(_tube) ⇒ Object
30 31 32 |
# File 'app/models/tube/purpose.rb', line 30 def sibling_tubes(_tube) nil end |
#stock_plate(_) ⇒ Object
Tubes of the general types have no stock plate!
15 16 17 |
# File 'app/models/tube/purpose.rb', line 15 def stock_plate(_) nil end |