Class: Hyrax::Transactions::Steps::SetUploadedDate

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

Overview

A ‘dry-transaction` step that sets the uploaded date to now for an input work.

Since:

  • 2.4.0

Instance Method Summary collapse

Instance Method Details

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

Note:

the current implementation sets the uploaded date to ‘#date_modified` if it exists, falling back on the current datetime.

Parameters:

Returns:

  • (Dry::Monads::Result)

Since:

  • 2.4.0



20
21
22
23
24
# File 'lib/hyrax/transactions/steps/set_uploaded_date.rb', line 20

def call(work)
  work.date_uploaded =
    work.date_modified || Hyrax::TimeService.time_in_utc
  Success(work)
end