Module: CaTissue::StorageTypeHolder
- Includes:
- PartialOrder
- Included in:
- StorageContainer, StorageType
- Defined in:
- lib/catissue/util/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_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.
35 36 37 38 39 40 41 42 43 |
# File 'lib/catissue/util/storage_type_holder.rb', line 35 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_specimen_array_types ⇒ StorageType
Returns the allowable child specimen array types.
19 20 21 |
# File 'lib/catissue/util/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/util/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/util/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.
25 26 27 |
# File 'lib/catissue/util/storage_type_holder.rb', line 25 def child_types child_storage_types.union(child_specimen_classes).union(child_specimen_array_types) end |