Class: PlateWalking::Walker

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

Overview

rubocop:todo Style/Documentation

Defined Under Namespace

Classes: Location

Instance Method Summary collapse

Constructor Details

#initialize(plate, wells) ⇒ Walker

Returns a new instance of Walker.



30
31
32
33
34
# File 'app/models/plate_walking.rb', line 30

def initialize(plate, wells)
  well_pair = plate.locations_in_rows.each_with_object({}) { |l, hash| hash[Location.new(l)] = nil }
  wells.each { |well| well_pair[Location.new(well.location)] = well }
  @rows = well_pair.group_by { |l, _| l.row }.map { |row_name, w| [row_name, w.map(&:last)] }
end