Class: Heron::Factories::PlateFromRack
- Inherits:
-
Object
- Object
- Heron::Factories::PlateFromRack
- Includes:
- ActiveModel::Model
- Defined in:
- app/models/heron/factories/plate_from_rack.rb
Overview
Factory class to create Heron tube racks
Instance Attribute Summary collapse
-
#plate ⇒ Object
Returns the value of attribute plate.
-
#plate_purpose ⇒ Object
Returns the value of attribute plate_purpose.
-
#tube_rack ⇒ Object
Returns the value of attribute tube_rack.
Instance Method Summary collapse
Instance Attribute Details
#plate ⇒ Object
Returns the value of attribute plate.
9 10 11 |
# File 'app/models/heron/factories/plate_from_rack.rb', line 9 def plate @plate end |
#plate_purpose ⇒ Object
Returns the value of attribute plate_purpose.
9 10 11 |
# File 'app/models/heron/factories/plate_from_rack.rb', line 9 def plate_purpose @plate_purpose end |
#tube_rack ⇒ Object
Returns the value of attribute tube_rack.
9 10 11 |
# File 'app/models/heron/factories/plate_from_rack.rb', line 9 def tube_rack @tube_rack end |
Instance Method Details
#plate_contents ⇒ Object
26 27 28 29 30 31 32 33 |
# File 'app/models/heron/factories/plate_from_rack.rb', line 26 def plate_contents tube_rack.racked_tubes.map do |racked_tube| {}.tap do |obj| obj['location'] = racked_tube.coordinate obj['sample_tube_uuid'] = racked_tube.tube.uuid end end end |
#save ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 |
# File 'app/models/heron/factories/plate_from_rack.rb', line 14 def save return false unless valid? ActiveRecord::Base.transaction do @plate = plate_purpose.create! ExtractionAttribute.create!(attributes_update: plate_contents, target: @plate, created_by: 'heron') AssetLink.create_edge(tube_rack, plate) end true end |