Class: BaitLibraryLayout

Inherits:
ApplicationRecord show all
Includes:
ModelExtensions::BaitLibraryLayout, Uuid::Uuidable
Defined in:
app/models/bait_library_layout.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Uuid::Uuidable

included, #unsaved_uuid!, #uuid

Methods inherited from ApplicationRecord

convert_labware_to_receptacle_for, find_by_id_or_name, find_by_id_or_name!

Methods included from Warren::BroadcastMessages

#broadcast, included, #queue_associated_for_broadcast, #queue_for_broadcast, #warren

Class Method Details

.preview!(attributes = {}, &block) ⇒ Object

This method can be used to view a previous of what will happen when the bait libraries are laid out on a plate.


76
77
78
79
80
81
82
83
# File 'app/models/bait_library_layout.rb', line 76

def self.preview!(attributes = {}, &block)
  new(attributes, &block).tap do |layout|
    raise ActiveRecord::RecordInvalid, layout unless layout.valid?

    layout.unsaved_uuid!
    layout.send(:generate_for_preview)
  end
end

Instance Method Details

#well_layoutObject


19
20
21
22
23
24
25
# File 'app/models/bait_library_layout.rb', line 19

def well_layout
  {}.tap do |well_to_name|
    layout.map do |name, locations|
      locations.map { |l| well_to_name[l] = name }
    end
  end
end