Class: CherrypickTask::PickTarget

Inherits:
Object
  • Object
show all
Defined in:
app/models/cherrypick_task.rb

Overview

An instance of this class represents the target plate being picked onto. It can have a template and be a partial plate, and so when wells are picked into it we need to ensure that we don't hit the template/partial wells.

Direct Known Subclasses

ByColumn, ByInterlacedColumn, ByRow

Defined Under Namespace

Classes: ByColumn, ByInterlacedColumn, ByRow

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(template, asset_shape = nil, partial = nil) ⇒ PickTarget


27
28
29
30
31
# File 'app/models/cherrypick_task.rb', line 27

def initialize(template, asset_shape = nil, partial = nil)
  @wells, @size, @shape = [], template.size, asset_shape || AssetShape.default
  initialize_already_occupied_wells_from(template, partial)
  add_any_wells_from_template_or_partial(@wells)
end

Class Method Details

.for(plate_purpose) ⇒ Object


22
23
24
25
# File 'app/models/cherrypick_task.rb', line 22

def self.for(plate_purpose)
  cherrypick_direction = plate_purpose.nil? ? 'column' : plate_purpose.cherrypick_direction
  const_get("by_#{cherrypick_direction}".classify)
end

Instance Method Details

#empty?Boolean


77
78
79
# File 'app/models/cherrypick_task.rb', line 77

def empty?
  @wells.empty?
end

#full?Boolean


81
82
83
# File 'app/models/cherrypick_task.rb', line 81

def full?
  @wells.size == @size
end

#push(request_id, plate_barcode, well_location) ⇒ Object


85
86
87
88
89
# File 'app/models/cherrypick_task.rb', line 85

def push(request_id, plate_barcode, well_location)
  @wells << [request_id, plate_barcode, well_location]
  add_any_wells_from_template_or_partial(@wells)
  self
end