Class: Hyrax::Actors::BaseActor

Inherits:
AbstractActor show all
Defined in:
app/actors/hyrax/actors/base_actor.rb

Overview

The Hyrax::BaseActor responds to two primary actions:

  • #create

  • #update

it must instantiate the next actor in the chain and instantiate it. it should respond to curation_concern, user and attributes.

Instance Attribute Summary collapse

Attributes inherited from AbstractActor

#next_actor

Instance Method Summary collapse

Methods inherited from AbstractActor

#initialize

Constructor Details

This class inherits a constructor from Hyrax::Actors::AbstractActor

Instance Attribute Details

#cloud_resourcesObject (readonly)

Returns the value of attribute cloud_resources.



9
10
11
# File 'app/actors/hyrax/actors/base_actor.rb', line 9

def cloud_resources
  @cloud_resources
end

Instance Method Details

#create(attributes) ⇒ Object



11
12
13
14
15
16
# File 'app/actors/hyrax/actors/base_actor.rb', line 11

def create(attributes)
  @cloud_resources = attributes.delete(:cloud_resources.to_s)
  apply_creation_data_to_curation_concern
  apply_save_data_to_curation_concern(attributes)
  save && next_actor.create(attributes) && run_callbacks(:after_create_concern)
end

#update(attributes) ⇒ Object



18
19
20
21
22
# File 'app/actors/hyrax/actors/base_actor.rb', line 18

def update(attributes)
  apply_update_data_to_curation_concern
  apply_save_data_to_curation_concern(attributes)
  next_actor.update(attributes) && save && run_callbacks(:after_update_metadata)
end