Class: Hyrax::Transactions::Steps::EnsureAdminSet

Inherits:
Object
  • Object
show all
Includes:
Dry::Transaction::Operation
Defined in:
lib/hyrax/transactions/steps/ensure_admin_set.rb

Overview

A `dry-transaction` step that ensures the input `work` has an AdminSet.

Since:

  • 2.4.0

Instance Method Summary collapse

Instance Method Details

#call(work) ⇒ Dry::Monads::Result

Returns `Failure` if there is no `AdminSet` for the input; `Success(input)`, otherwise.

Parameters:

Returns:

  • (Dry::Monads::Result)

    `Failure` if there is no `AdminSet` for the input; `Success(input)`, otherwise.

Since:

  • 2.4.0


17
18
19
# File 'lib/hyrax/transactions/steps/ensure_admin_set.rb', line 17

def call(work)
  work.admin_set_id ? Success(work) : Failure(:no_admin_set_id)
end