Class: Hyrax::Actors::ActiveFedoraToValkyrie

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

Overview

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

If the curation concern is not an `ActiveFedora::Base` this is a no-op.

This can be used in conjunction with `ValkyrieToActiveFedora` 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/active_fedora_to_valkyrie.rb', line 32

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

#destroy(env) ⇒ Boolean

Returns true.

Parameters:

Returns:

  • (Boolean)

    true


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

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

#update(env) ⇒ Boolean

Returns true.

Parameters:

Returns:

  • (Boolean)

    true


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

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