Class: CurationConcerns::Actors::ActorStack
- Inherits:
-
Object
- Object
- CurationConcerns::Actors::ActorStack
- Defined in:
- app/actors/curation_concerns/actors/actor_stack.rb
Overview
Instance Attribute Summary collapse
- #curation_concern ⇒ Object readonly
- #first_actor_class ⇒ Object readonly
- #more_actors ⇒ Object readonly
- #user ⇒ Object readonly
Instance Method Summary collapse
- #actor ⇒ Object
- #create(new_attributes) ⇒ Object
- #destroy ⇒ Object
-
#initialize(curation_concern, user, more_actors) ⇒ ActorStack
constructor
A new instance of ActorStack.
- #inner_stack ⇒ Object
- #update(new_attributes) ⇒ Object
Constructor Details
#initialize(curation_concern, user, more_actors) ⇒ ActorStack
Returns a new instance of ActorStack.
5 6 7 8 9 10 |
# File 'app/actors/curation_concerns/actors/actor_stack.rb', line 5 def initialize(curation_concern, user, more_actors) @curation_concern = curation_concern @user = user @more_actors = more_actors @first_actor_class = @more_actors.shift || RootActor end |
Instance Attribute Details
#curation_concern ⇒ Object (readonly)
4 5 6 |
# File 'app/actors/curation_concerns/actors/actor_stack.rb', line 4 def curation_concern @curation_concern end |
#first_actor_class ⇒ Object (readonly)
4 5 6 |
# File 'app/actors/curation_concerns/actors/actor_stack.rb', line 4 def first_actor_class @first_actor_class end |
#more_actors ⇒ Object (readonly)
4 5 6 |
# File 'app/actors/curation_concerns/actors/actor_stack.rb', line 4 def more_actors @more_actors end |
#user ⇒ Object (readonly)
4 5 6 |
# File 'app/actors/curation_concerns/actors/actor_stack.rb', line 4 def user @user end |
Instance Method Details
#actor ⇒ Object
16 17 18 |
# File 'app/actors/curation_concerns/actors/actor_stack.rb', line 16 def actor first_actor_class.new(curation_concern, user, inner_stack) end |
#create(new_attributes) ⇒ Object
21 22 23 |
# File 'app/actors/curation_concerns/actors/actor_stack.rb', line 21 def create(new_attributes) actor.create(cast_to_indifferent_hash(new_attributes)) end |
#destroy ⇒ Object
30 31 32 33 34 35 36 37 |
# File 'app/actors/curation_concerns/actors/actor_stack.rb', line 30 def destroy curation_concern.in_collection_ids.each do |id| destination_collection = ::Collection.find(id) destination_collection.members.delete(curation_concern) destination_collection.update_index end curation_concern.destroy end |
#inner_stack ⇒ Object
12 13 14 |
# File 'app/actors/curation_concerns/actors/actor_stack.rb', line 12 def inner_stack Actors::ActorStack.new(curation_concern, user, more_actors) end |
#update(new_attributes) ⇒ Object
26 27 28 |
# File 'app/actors/curation_concerns/actors/actor_stack.rb', line 26 def update(new_attributes) actor.update(cast_to_indifferent_hash(new_attributes)) end |