Class: Plate
- Inherits:
-
ApplicationRecord
- Object
- ActiveRecord::Base
- ApplicationRecord
- Plate
- Includes:
- Labware
- Defined in:
- app/models/plate.rb
Overview
Plate
Constant Summary collapse
- DEFAULT_SIZE =
96
Constants included from Labware
Instance Method Summary collapse
-
#formatted_range(wells) ⇒ String
Compacts the provided well range into an easy to read summary.
-
#wells_by_column_then_row ⇒ Object
sorts as: A1 B1 C1 …
-
#wells_by_row_then_column ⇒ Object
sorts as: A1 A2 A3 …
Methods included from Labware
Instance Method Details
#formatted_range(wells) ⇒ String
Compacts the provided well range into an easy to read summary. e.g.. formatted_range([‘A1’, ‘B1’, ‘C1’,‘A2’,‘A5’,‘B5’]) => ‘A1-C1,A2,A5-B5’ Mostly this will just be start_well-end_well
59 60 61 |
# File 'app/models/plate.rb', line 59 def formatted_range(wells) WellSorterService.formatted_range(wells, DEFAULT_SIZE) end |
#wells_by_column_then_row ⇒ Object
sorts as: A1 B1 C1 … A2 B2 …
41 42 43 |
# File 'app/models/plate.rb', line 41 def wells_by_column_then_row wells.sort { |a, b| a.column == b.column ? a.row <=> b.row : a.column <=> b.column } end |
#wells_by_row_then_column ⇒ Object
sorts as: A1 A2 A3 … B1 B2 …
46 47 48 |
# File 'app/models/plate.rb', line 46 def wells_by_row_then_column wells.sort { |a, b| a.row == b.row ? a.column <=> b.column : a.row <=> b.row } end |