Class: Hyrax::Transactions::Steps::SetModifiedDate
- Inherits:
-
Object
- Object
- Hyrax::Transactions::Steps::SetModifiedDate
- Defined in:
- lib/hyrax/transactions/steps/set_modified_date.rb
Overview
A step that sets the modified date to now for an input resource or change_set
Instance Method Summary collapse
- #call(obj) ⇒ Dry::Monads::Result
-
#initialize(time_service: Hyrax::TimeService) ⇒ SetModifiedDate
constructor
A new instance of SetModifiedDate.
Constructor Details
#initialize(time_service: Hyrax::TimeService) ⇒ SetModifiedDate
Returns a new instance of SetModifiedDate.
15 16 17 |
# File 'lib/hyrax/transactions/steps/set_modified_date.rb', line 15 def initialize(time_service: Hyrax::TimeService) @time_service = time_service end |
Instance Method Details
#call(obj) ⇒ Dry::Monads::Result
23 24 25 26 27 28 29 30 |
# File 'lib/hyrax/transactions/steps/set_modified_date.rb', line 23 def call(obj) return Failure[:no_date_modified_attribute, obj] unless obj.respond_to?(:date_modified=) obj.date_modified = @time_service.time_in_utc Success(obj) end |