Class: Hyrax::Actors::ActorStack
- Inherits:
-
Object
- Object
- Hyrax::Actors::ActorStack
- Defined in:
- app/actors/hyrax/actors/actor_stack.rb
Instance Attribute Summary collapse
-
#curation_concern ⇒ Object
readonly
Returns the value of attribute curation_concern.
-
#first_actor_class ⇒ Object
readonly
Returns the value of attribute first_actor_class.
-
#more_actors ⇒ Object
readonly
Returns the value of attribute more_actors.
-
#user ⇒ Object
readonly
Returns the value of attribute user.
Instance Method Summary collapse
- #ability ⇒ Object
- #actor ⇒ Object
- #create(new_attributes) ⇒ Object
- #destroy ⇒ Object
-
#initialize(curation_concern, user_or_ability, more_actors) ⇒ ActorStack
constructor
A new instance of ActorStack.
- #inner_stack ⇒ Object
- #update(new_attributes) ⇒ Object
Constructor Details
#initialize(curation_concern, user_or_ability, more_actors) ⇒ ActorStack
Returns a new instance of ActorStack.
5 6 7 8 9 10 |
# File 'app/actors/hyrax/actors/actor_stack.rb', line 5 def initialize(curation_concern, user_or_ability, more_actors) @curation_concern = curation_concern self.user = user_or_ability @more_actors = more_actors @first_actor_class = @more_actors.shift || RootActor end |
Instance Attribute Details
#curation_concern ⇒ Object (readonly)
Returns the value of attribute curation_concern.
4 5 6 |
# File 'app/actors/hyrax/actors/actor_stack.rb', line 4 def curation_concern @curation_concern end |
#first_actor_class ⇒ Object (readonly)
Returns the value of attribute first_actor_class.
4 5 6 |
# File 'app/actors/hyrax/actors/actor_stack.rb', line 4 def first_actor_class @first_actor_class end |
#more_actors ⇒ Object (readonly)
Returns the value of attribute more_actors.
4 5 6 |
# File 'app/actors/hyrax/actors/actor_stack.rb', line 4 def more_actors @more_actors end |
#user ⇒ Object
Returns the value of attribute user.
4 5 6 |
# File 'app/actors/hyrax/actors/actor_stack.rb', line 4 def user @user end |
Instance Method Details
#ability ⇒ Object
40 41 42 |
# File 'app/actors/hyrax/actors/actor_stack.rb', line 40 def ability @ability ||= ::Ability.new(user) end |
#actor ⇒ Object
16 17 18 19 |
# File 'app/actors/hyrax/actors/actor_stack.rb', line 16 def actor ## Change this to pass in the ability instead of user for next version. first_actor_class.new(curation_concern, user, inner_stack, ability: ability) end |
#create(new_attributes) ⇒ Object
22 23 24 |
# File 'app/actors/hyrax/actors/actor_stack.rb', line 22 def create(new_attributes) actor.create(cast_to_indifferent_hash(new_attributes)) end |
#destroy ⇒ Object
31 32 33 34 35 36 37 38 |
# File 'app/actors/hyrax/actors/actor_stack.rb', line 31 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/hyrax/actors/actor_stack.rb', line 12 def inner_stack Actors::ActorStack.new(curation_concern, ability, more_actors) end |
#update(new_attributes) ⇒ Object
27 28 29 |
# File 'app/actors/hyrax/actors/actor_stack.rb', line 27 def update(new_attributes) actor.update(cast_to_indifferent_hash(new_attributes)) end |