Class: BaitLibraryLayout
- Inherits:
-
ApplicationRecord
- Object
- ActiveRecord::Base
- ApplicationRecord
- BaitLibraryLayout
- Includes:
- ModelExtensions::BaitLibraryLayout, Uuid::Uuidable
- Defined in:
- app/models/bait_library_layout.rb
Class Method Summary collapse
-
.preview!(attributes = {}, &block) ⇒ Object
This method can be used to get a preview of what will happen when the bait libraries are laid out on a plate.
Instance Method Summary collapse
Methods included from Uuid::Uuidable
included, #unsaved_uuid!, #uuid
Methods inherited from ApplicationRecord
alias_association, convert_labware_to_receptacle_for, find_by_id_or_name, find_by_id_or_name!
Methods included from Squishify
Class Method Details
.preview!(attributes = {}, &block) ⇒ Object
This method can be used to get a preview of what will happen when the bait libraries are laid out on a plate.
29 30 31 32 33 34 35 36 |
# File 'app/models/bait_library_layout.rb', line 29 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_layout ⇒ Object
24 25 26 |
# File 'app/models/bait_library_layout.rb', line 24 def well_layout {}.tap { |well_to_name| layout.map { |name, locations| locations.map { |l| well_to_name[l] = name } } } end |