Module: CaTissue::StorageTypeHolder
- Includes:
- Jinx::PartialOrder
- Included in:
- StorageContainer, StorageType
- Defined in:
- lib/catissue/helpers/storage_type_holder.rb
Overview
The StorageTypeHolder mix-in adds common methods for the StorageType or StorageContainer child type accessors.
Instance Method Summary collapse
-
#add_child_type(type) ⇒ StorageTypeHolder
Adds the given subtype to the list of subtypes which this StorageType can hold.
-
#child_container_types ⇒ Object
Returns the SpecimenArrayType or StorageType children which this StorageTypeHolder can hold.
-
#child_specimen_array_types ⇒ StorageType
The allowable child specimen array types.
-
#child_specimen_classes ⇒ String
The allowable child specimen classes.
-
#child_storage_types ⇒ StorageType
The allowable child storage types.
-
#child_types ⇒ Object
Returns the SpecimenArrayType, AbstractSpecimen#specimen_class or StorageType children which this StorageTypeHolder can hold.
Instance Method Details
#add_child_type(type) ⇒ StorageTypeHolder
Adds the given subtype to the list of subtypes which this StorageType can hold.
41 42 43 44 45 46 47 48 49 |
# File 'lib/catissue/helpers/storage_type_holder.rb', line 41 def add_child_type(type) case type when CaTissue::StorageType then add_storage_type(type) when CaTissue::SpecimenArrayType then add_specimen_array_type(type) when String then add_specimen_class(type) else raise ArgumentError.new("Storage type child not supported - #{type}") end self end |
#child_container_types ⇒ Object
Returns the CaTissue::SpecimenArrayType or CaTissue::StorageType children which this StorageTypeHolder can hold.
25 26 27 |
# File 'lib/catissue/helpers/storage_type_holder.rb', line 25 def child_container_types @ccts ||= child_storage_types.union(child_specimen_array_types) end |
#child_specimen_array_types ⇒ StorageType
Returns the allowable child specimen array types.
19 20 21 |
# File 'lib/catissue/helpers/storage_type_holder.rb', line 19 def child_specimen_array_types holds_specimen_array_types end |
#child_specimen_classes ⇒ String
Returns the allowable child specimen classes.
14 15 16 |
# File 'lib/catissue/helpers/storage_type_holder.rb', line 14 def child_specimen_classes holds_specimen_classes end |
#child_storage_types ⇒ StorageType
Returns the allowable child storage types.
9 10 11 |
# File 'lib/catissue/helpers/storage_type_holder.rb', line 9 def child_storage_types holds_storage_types end |
#child_types ⇒ Object
Returns the CaTissue::SpecimenArrayType, AbstractSpecimen#specimen_class or CaTissue::StorageType children which this StorageTypeHolder can hold.
31 32 33 |
# File 'lib/catissue/helpers/storage_type_holder.rb', line 31 def child_types @cts ||= child_container_types.union(child_specimen_classes) end |