Class: SpecificTubeRackCreation

Inherits:
AssetCreation show all
Defined in:
app/models/specific_tube_rack_creation.rb

Overview

Allows for the creation of multiple tube racks and their tubes. rubocop:disable Metrics/ClassLength

Defined Under Namespace

Classes: ChildPurpose, ChildTubeRack

Constant Summary collapse

DEFAULT_TARGET_TYPE =
'TubeRack'

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from AssetCreation

#create_ancestor_asset!

Methods included from Asset::Ownership::ChangesOwner

included

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

extended

Instance Attribute Details

#tube_rack_attributesObject

If no tube rack attributes are specified, fall back to an empty array



73
74
75
# File 'app/models/specific_tube_rack_creation.rb', line 73

def tube_rack_attributes
  @tube_rack_attributes || Array.new(child_purposes.length, {})
end

Instance Method Details

#multiple_purposesObject

See asset_creation, flag to indicate that multiple child purposes are expected and skip validation



78
79
80
# File 'app/models/specific_tube_rack_creation.rb', line 78

def multiple_purposes
  true
end

#parentObject

singular 'parent' getter to stay backwards compatible



63
64
65
# File 'app/models/specific_tube_rack_creation.rb', line 63

def parent
  parents.first
end

#parent=(parent) ⇒ Object

singular 'parent' setter to stay backwards compatible



68
69
70
# File 'app/models/specific_tube_rack_creation.rb', line 68

def parent=(parent)
  self.parents = [parent]
end