Module: Limber::TagLayoutTemplate::WalkWellsOfPlate

Defined in:
app/models/limber/tag_layout_template/walk_wells_of_plate.rb

Overview

rubocop:todo Style/Documentation

Instance Method Summary collapse

Instance Method Details

#generate_tag_layout(plate) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
# File 'app/models/limber/tag_layout_template/walk_wells_of_plate.rb', line 4

def generate_tag_layout(plate)
  tagged_wells = {}
  tags = tag_ids
  groups = group_wells_of_plate(plate)
  pools = groups.filter_map { |w| w.try(:[], 1) }.uniq

  groups.each_with_index do |(well, pool_id, _well_empty), index|
    throw :unacceptable_tag_layout if tags.size <= index
    tagged_wells[well] = [pools.index(pool_id) + 1, tags[index]] unless well.nil?
  end

  tagged_wells
end