Class: Hyrax::Actors::ValkyrieToActiveFedora

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

Overview

Casts ‘env.curation_concern` from a `Valkyrie::Resource` to an `ActiveFedora::Base` model.

If the curation concern is not a ‘Valkyrie::Resource` this is a no-op.

This can be used in conjunction with ‘ActiveFedoraToValkyrie` to create a vertical boundary in the actor stack between actors that deal with `ActiveFedora` models and those that work on `Valkyrie::Resource` objects.

Examples:

defining a stack using both ActiveFedora and Valkyrie actors

stack = ActionDispatch::MiddlewareStack.new.tap do |middleware|
  middleware.use ActorThatUsesActiveFedora
  middleware.use AnotherActorThatUsesActiveFedora
  middleware.use ValkyrieToActiveFedora # casts on the way up
  middleware.use ActiveFedoraToValkyrie # casts on the way down
  middleware.use ActorThatUsesValkyrie
  middleware.use AnotherActorThatUsesValkyrie
end

actor = stack.build(Hyrax::Actors::Terminator.new)

See Also:

Instance Attribute Summary

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 Method Details

#create(env) ⇒ Boolean

Returns true.

Parameters:

Returns:

  • (Boolean)

    true



32
33
34
# File 'app/actors/hyrax/actors/valkyrie_to_active_fedora.rb', line 32

def create(env)
  next_actor.create(env) && cast(env)
end

#destroy(env) ⇒ Boolean

Returns true.

Parameters:

Returns:

  • (Boolean)

    true



44
45
46
# File 'app/actors/hyrax/actors/valkyrie_to_active_fedora.rb', line 44

def destroy(env)
  next_actor.destroy(env) && cast(env)
end

#update(env) ⇒ Boolean

Returns true.

Parameters:

Returns:

  • (Boolean)

    true



38
39
40
# File 'app/actors/hyrax/actors/valkyrie_to_active_fedora.rb', line 38

def update(env)
  next_actor.update(env) && cast(env)
end