Class: SampleManifest::TubeRackBehaviour::Core
- Inherits:
-
SharedTubeBehaviour::Base
- Object
- SharedTubeBehaviour::Base
- SampleManifest::TubeRackBehaviour::Core
- Defined in:
- app/models/sample_manifest/tube_rack_behaviour.rb
Overview
Specifies behaviour for generation of Tube Rack Manifests Ends up being included in SampleManifest model because is instantiated in CoreBehaviour
Instance Attribute Summary collapse
-
#tubes ⇒ Object
readonly
Returns the value of attribute tubes.
Instance Method Summary collapse
- #acceptable_purposes ⇒ Object
- #acceptable_rack_purposes ⇒ Object
- #default_purpose ⇒ Object
- #default_tube_rack_purpose ⇒ Object
- #generate ⇒ Object
-
#included_resources ⇒ Object
when uploading the manifest, this specifies which resources are queried and stored in the Cache accessed through sample_manifest.sample_manifest_assets.includes(<resources below>).
-
#initialize(manifest) ⇒ Core
constructor
A new instance of Core.
Methods included from CoreBehaviour::StockAssets
#generate_sample_and_aliquot, #stocks?, #tag_depth_for_sample
Methods included from CoreBehaviour::NoSpecializedValidation
#specialized_fields, #validate_specialized_fields
Methods inherited from SharedTubeBehaviour::Base
Methods included from CoreBehaviour::Shared
#details, #generate_sanger_ids, included
Constructor Details
#initialize(manifest) ⇒ Core
Returns a new instance of Core.
12 13 14 15 |
# File 'app/models/sample_manifest/tube_rack_behaviour.rb', line 12 def initialize(manifest) @manifest = manifest @tubes = [] end |
Instance Attribute Details
#tubes ⇒ Object (readonly)
Returns the value of attribute tubes.
10 11 12 |
# File 'app/models/sample_manifest/tube_rack_behaviour.rb', line 10 def tubes @tubes end |
Instance Method Details
#acceptable_purposes ⇒ Object
22 23 24 |
# File 'app/models/sample_manifest/tube_rack_behaviour.rb', line 22 def acceptable_purposes Tube::Purpose.where(target_type: SampleTube) end |
#acceptable_rack_purposes ⇒ Object
26 27 28 |
# File 'app/models/sample_manifest/tube_rack_behaviour.rb', line 26 def acceptable_rack_purposes TubeRack::Purpose.where(target_type: TubeRack) end |
#default_purpose ⇒ Object
30 31 32 |
# File 'app/models/sample_manifest/tube_rack_behaviour.rb', line 30 def default_purpose Tube::Purpose.standard_sample_tube end |
#default_tube_rack_purpose ⇒ Object
34 35 36 |
# File 'app/models/sample_manifest/tube_rack_behaviour.rb', line 34 def default_tube_rack_purpose TubeRack::Purpose.standard_tube_rack end |
#generate ⇒ Object
17 18 19 20 |
# File 'app/models/sample_manifest/tube_rack_behaviour.rb', line 17 def generate desired_number_of_tubes = count * @manifest.tube_rack_purpose.size @tubes = generate_tubes(purpose, desired_number_of_tubes) end |
#included_resources ⇒ Object
when uploading the manifest, this specifies which resources are queried and stored in the Cache accessed through sample_manifest.sample_manifest_assets.includes(<resources below>)
40 41 42 |
# File 'app/models/sample_manifest/tube_rack_behaviour.rb', line 40 def included_resources [{ sample: :sample_metadata, asset: %i[labware aliquots barcodes] }] end |