Class: Hyrax::Actors::EmbargoActor
- Inherits:
-
Object
- Object
- Hyrax::Actors::EmbargoActor
- Defined in:
- app/actors/hyrax/actors/embargo_actor.rb
Instance Attribute Summary collapse
-
#work ⇒ Object
readonly
Returns the value of attribute work.
Instance Method Summary collapse
-
#destroy ⇒ Object
Update the visibility of the work to match the correct state of the embargo, then clear the embargo date, etc.
-
#initialize(work) ⇒ EmbargoActor
constructor
A new instance of EmbargoActor.
Constructor Details
#initialize(work) ⇒ EmbargoActor
Returns a new instance of EmbargoActor.
8 9 10 |
# File 'app/actors/hyrax/actors/embargo_actor.rb', line 8 def initialize(work) @work = work end |
Instance Attribute Details
#work ⇒ Object (readonly)
Returns the value of attribute work.
5 6 7 |
# File 'app/actors/hyrax/actors/embargo_actor.rb', line 5 def work @work end |
Instance Method Details
#destroy ⇒ Object
Update the visibility of the work to match the correct state of the embargo, then clear the embargo date, etc. Saves the embargo and the work
14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'app/actors/hyrax/actors/embargo_actor.rb', line 14 def destroy case work when Valkyrie::Resource Hyrax::EmbargoManager.(resource: work) && Hyrax.persister.save(resource: work.) && Hyrax::AccessControlList(work).save else work. # If the embargo has lapsed, update the current visibility. work. work..save! work.save! end end |