Class: Hyrax::Transactions::Steps::SetUserAsDepositor
- Inherits:
-
Object
- Object
- Hyrax::Transactions::Steps::SetUserAsDepositor
- Defined in:
- lib/hyrax/transactions/steps/set_user_as_depositor.rb
Overview
Add a given ‘::User` as the `#depositor` via a ChangeSet.
If no user is given, simply passes as a ‘Success`.
Defined Under Namespace
Classes: NullUser
Instance Method Summary collapse
Instance Method Details
#call(change_set, user: NullUser.new) ⇒ Dry::Monads::Result
21 22 23 24 25 26 27 |
# File 'lib/hyrax/transactions/steps/set_user_as_depositor.rb', line 21 def call(change_set, user: NullUser.new) change_set.depositor = user.user_key if user.user_key Success(change_set) rescue NoMethodError => err Failure([err., change_set]) end |