Class: Robots::SplittingRobot
- Defined in:
- app/models/robots/splitting_robot.rb
Overview
A splitting robot takes one parent labware, and transfers it to multiple children Child labwares are numbered based on the order in which they first appear when transfers are sorted in column order.
Direct Known Subclasses
Instance Attribute Summary collapse
-
#relationships ⇒ Object
writeonly
Sets the attribute relationships.
Instance Method Summary collapse
- #bed_class ⇒ Object
-
#valid_relationships ⇒ Hash<String => Boolean>
Returns a hash of bed barcodes and their valid state Also adds any errors describing invalid bed states.
- #well_order ⇒ Object
Instance Attribute Details
#relationships=(value) ⇒ Object (writeonly)
Sets the attribute relationships
8 9 10 |
# File 'app/models/robots/splitting_robot.rb', line 8 def relationships=(value) @relationships = value end |
Instance Method Details
#bed_class ⇒ Object
38 39 40 |
# File 'app/models/robots/splitting_robot.rb', line 38 def bed_class Robots::Bed::Splitting end |
#valid_relationships ⇒ Hash<String => Boolean>
Returns a hash of bed barcodes and their valid state Also adds any errors describing invalid bed states
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'app/models/robots/splitting_robot.rb', line 19 def valid_relationships # rubocop:todo Metrics/AbcSize raise StandardError, "Relationships for #{name} are empty" if @relationships.empty? @relationships.each_with_object({}) do |relationship, validations| parent_bed = relationship.dig('options', 'parent') child_beds = relationship.dig('options', 'children') validations[parent_bed] = beds[parent_bed].child_labware.present? error(beds[parent_bed], 'should not be empty.') if beds[parent_bed].empty? error(beds[parent_bed], 'should have children.') if beds[parent_bed].child_labware.empty? expected_children = beds[parent_bed].child_labware expected_children.each_with_index do |expected_child, index| child_bed = child_beds[index] validations[child_bed] = check_labware_identity([expected_child], child_bed) end end end |
#well_order ⇒ Object
10 11 12 |
# File 'app/models/robots/splitting_robot.rb', line 10 def well_order :quadrant_index end |