Class: Hyrax::ChildTypes
- Inherits:
-
Object
- Object
- Hyrax::ChildTypes
- Extended by:
- Forwardable
- Includes:
- Enumerable
- Defined in:
- app/services/hyrax/child_types.rb
Overview
A list of child work types a user may choose to attach for a given work type
These lists are used when users select among work types to attach to an existing work, e.g. from Actions available on the show view.
Instance Attribute Summary collapse
-
#types ⇒ Object
readonly
Returns the value of attribute types.
Class Method Summary collapse
-
.for(parent:) ⇒ Enumerable<Class>
A list of classes that are valid as child types for ‘parent`.
Instance Method Summary collapse
-
#initialize(types) ⇒ ChildTypes
constructor
A new instance of ChildTypes.
Constructor Details
#initialize(types) ⇒ ChildTypes
Returns a new instance of ChildTypes.
36 37 38 |
# File 'app/services/hyrax/child_types.rb', line 36 def initialize(types) @types = types.to_a end |
Instance Attribute Details
#types ⇒ Object (readonly)
Returns the value of attribute types.
22 23 24 |
# File 'app/services/hyrax/child_types.rb', line 22 def types @types end |
Class Method Details
.for(parent:) ⇒ Enumerable<Class>
Returns a list of classes that are valid as child types for ‘parent`.
27 28 29 30 31 32 |
# File 'app/services/hyrax/child_types.rb', line 27 def self.for(parent:) return new(parent.valid_child_concerns) if parent.respond_to?(:valid_child_concerns) new([parent]) end |