Class: Hyrax::Transactions::Steps::SetCollectionTypeGid
- Inherits:
-
Object
- Object
- Hyrax::Transactions::Steps::SetCollectionTypeGid
- Defined in:
- lib/hyrax/transactions/steps/set_collection_type_gid.rb
Overview
A step that sets the ‘#collection_type_gid` in the change set.
Instance Method Summary collapse
-
#call(change_set, collection_type_gid: default_collection_type_gid) ⇒ Dry::Monads::Result
‘Failure` if there is no `collection_type_gid` or it can’t be set to the default for the input; ‘Success(input)`, otherwise.
Instance Method Details
#call(change_set, collection_type_gid: default_collection_type_gid) ⇒ Dry::Monads::Result
Returns ‘Failure` if there is no `collection_type_gid` or it can’t be set to the default for the input; ‘Success(input)`, otherwise.
17 18 19 20 21 22 23 24 25 |
# File 'lib/hyrax/transactions/steps/set_collection_type_gid.rb', line 17 def call(change_set, collection_type_gid: default_collection_type_gid) return Failure[:no_collection_type_gid, collection] unless change_set.respond_to?(:collection_type_gid=) return Success(change_set) if change_set.collection_type_gid.present? change_set.collection_type_gid = collection_type_gid Success(change_set) end |